diff --git a/.gitignore b/.gitignore index b824904..400a044 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,4 @@ node_modules/ -build/*.js -build/*.txt -build/node/*.js -build/node/*.txt -build/web/*.js -build/web/*.txt -build/hermes/*.js results/*.txt results/*.csv puppeteer/index.bundle.js diff --git a/build-test-bundles.js b/build-test-bundles.js new file mode 100644 index 0000000..4466646 --- /dev/null +++ b/build-test-bundles.js @@ -0,0 +1,228 @@ +const fs = require("fs"); +const path = require("path"); +const webpack = require("webpack"); + +function readPerfFiles(dirPath) { + const files = fs.readdirSync(dirPath); + const perfFiles = []; + + files.forEach((file) => { + const filePath = path.join(dirPath, file); + const stat = fs.statSync(filePath); + + if (stat.isDirectory()) { + perfFiles.push(...readPerfFiles(filePath)); + } else if (filePath.includes(".perf.md")) { + perfFiles.push(filePath); + } + }); + + return perfFiles; +} + +function readPerfFile(filePath) { + const fileContent = fs.readFileSync(filePath, "utf-8"); + const metadata = {}; + let imports = ""; + let source = ""; + + // Regular expression for the metadata block + const metadataRegex = /---([\s\S]*?)---/; + const metadataMatch = fileContent.match(metadataRegex); + if (metadataMatch) { + const metadataString = metadataMatch[1].trim(); + metadataString.split("\n").forEach((line) => { + const [key, value] = line.split(":").map((str) => str.trim()); + metadata[key] = value; + }); + } + + // Regular expression for the import statements block + const importsRegex = /```js\n(import [\s\S]*?)\n```/; + const importsMatch = fileContent.match(importsRegex); + if (importsMatch) { + imports = importsMatch[1].trim(); + } + + // Regular expression for the JavaScript code block + const sourceRegex = /```js\n([\s\S]*?)\n```/g; + let sourceMatch; + while ((sourceMatch = sourceRegex.exec(fileContent)) !== null) { + // This ensures that we don't capture the import block again + if (!sourceMatch[1].startsWith("import ")) { + source += sourceMatch[1].trim() + "\n"; + } + } + + return { metadata, imports, source }; +} + +function createBundleSource(metadata, imports, source) { + return ` +${imports} +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add(${metadata.title}, () => { + const startMemory = getStartMemory(); + ${source} + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory(${metadata.title}, memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); +`; +} + +function goodFileName(str) { + // Replace spaces with dashes + let fileSafeStr = str.replace(/\s+/g, "-"); + + // Convert to lowercase + fileSafeStr = fileSafeStr.toLowerCase(); + + // Remove special characters + fileSafeStr = fileSafeStr.replace(/[^\w-]+/g, ""); + + return fileSafeStr; +} + +function bundleWithWebpack(entryPath, outputPath, platform) { + return new Promise((resolve, reject) => { + const config = { + mode: "production", + entry: entryPath, + output: { + filename: path.basename(outputPath), + path: path.dirname(outputPath), + libraryTarget: platform === "node" ? "commonjs2" : "var", + library: "suite", + }, + target: platform === "node" ? "node" : "web", + externals: platform === "node" ? ["benchmark"] : [], + }; + + webpack(config, (err, stats) => { + if (err || stats.hasErrors()) { + console.error("Webpack build error:", err || stats.toJson().errors); + reject(err); + return; + } + console.log(`Bundle created at ${outputPath}`); + resolve(); + }); + }); +} + +// Driver code +(async () => { + const perfFiles = readPerfFiles(__dirname); + console.log(`Found ${perfFiles.length} performance files`); + + for (let i = 0; i < perfFiles.length; i++) { + const filePath = perfFiles[i]; + console.log(`Processing ${filePath}`); + const { metadata, imports, source } = readPerfFile(filePath); + console.log(`Generating bundles for ${metadata.title}`); + + const bundleSource = createBundleSource(metadata, imports, source); + const bundleFileName = goodFileName(metadata.title); + // Write bundle source to file + const bundleSourcePath = path.join( + __dirname, + "build", + `${bundleFileName}-bundle-source.js` + ); + + fs.writeFileSync(bundleSourcePath, bundleSource); + + // Define the output file paths + const webBundlePath = path.join( + __dirname, + "build", + `${bundleFileName}-web-bundle.js` + ); + const nodeBundlePath = path.join( + __dirname, + "build", + `${bundleFileName}-node-bundle.js` + ); + + // Bundle for the web + await bundleWithWebpack(bundleSourcePath, webBundlePath, "web"); + + // Bundle for Node + await bundleWithWebpack(bundleSourcePath, nodeBundlePath, "node"); + } +})(); diff --git a/build/add-1-object-to-an-array-bundle-source.js b/build/add-1-object-to-an-array-bundle-source.js new file mode 100644 index 0000000..c9c2de4 --- /dev/null +++ b/build/add-1-object-to-an-array-bundle-source.js @@ -0,0 +1,104 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Add 1 object to an array", () => { + const startMemory = getStartMemory(); + const SampleModel = types.model({ + name: types.string, + id: types.string, +}); + +const SampleStore = types + .model({ + items: types.array(SampleModel), + }) + .actions((self) => ({ + add(name, id) { + self.items.push({ name, id }); + }, + })); + +/** + * Requested by the community in https://github.com/coolsoftwaretyler/mst-performance-testing/issues/26 + */ +const store = SampleStore.create({ items: [] }); +store.add(`item-1`, `id-1`); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Add 1 object to an array", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/add-1-object-to-an-array-node-bundle.js b/build/add-1-object-to-an-array-node-bundle.js new file mode 100644 index 0000000..046bc99 --- /dev/null +++ b/build/add-1-object-to-an-array-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see add-1-object-to-an-array-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Vt(e){return v(e)&&!0===e.isMobxAction}function Ct(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Vr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Vr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Vr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Vr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Ct((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Vr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Vr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},C(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Vr=P("ObservableMap",Nr),Cr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Cr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Vr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Vr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Vi?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Vi&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Cn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Vn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Cn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Vn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Va=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Ca={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Ci(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Add 1 object to an array",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=Ca.model({name:Ca.string,id:Ca.string});var r,n;Ca.model({items:Ca.array(t)}).actions((e=>({add(t,r){e.items.push({name:t,id:r})}}))).create({items:[]}).add("item-1","id-1"),r="Add 1 object to an array",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[r]?ka[r]=Math.max(ka[r],n):ka[r]=n})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/add-1-object-to-an-array-node-bundle.js.LICENSE.txt b/build/add-1-object-to-an-array-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/add-1-object-to-an-array-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/add-1-object-to-an-array-web-bundle.js b/build/add-1-object-to-an-array-web-bundle.js new file mode 100644 index 0000000..db41db9 --- /dev/null +++ b/build/add-1-object-to-an-array-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see add-1-object-to-an-array-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,s=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),l=a.object&&e&&!e.nodeType&&e,c=s&&l&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(l&&l.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,l=e.Object,c=(e.RegExp,e.String),_=[],m=l.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,le(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=s&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,s={currentTarget:e},l={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),s.type="cycle",s.target=r,n=W(s),l.onCycle.call(e,n),n.aborted||!1===b())s.type="complete",l.onComplete.call(e,W(s));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function se(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function le(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,s=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+s+")"),fnArg:s,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}le=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,s=Z(u.fn),l=u.count=i.count,f=s||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||s);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=l)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=l}if(!v&&!a&&!y){v=o(u,f,a,d=(s||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=l,delete i.error}catch(e){u.count=l,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),le.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,s,l,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:le(t),l=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((s=W("error")).message=t.error,t.emit(s),s.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==l?1:-1:0):f<=(u<5||s<3?0:y[u][s-3])?f==l?1:-1:0},emit:oe,listeners:ae,off:ue,on:se,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,s=u.destination,l=s[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(l)||(r=!0,l=[]),l.length!=e.length&&(r=!0,(l=l.slice(0,e.length)).length=e.length)):t.isObjectLike(l)||(r=!0,l={}),r&&i.push({destination:s,key:n,value:l}),a.push({destination:l,source:e})):t.eq(l,e)||e===o||i.push({destination:s,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,s=[],l=e.stats.sample;function c(){s.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(s,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=l.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=l.length=s.length=0)),_||(f=q(l),y=t.reduce(l,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),s.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",s=32,l=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",l],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",s],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,se=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,le=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,st=parseInt,lt="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=lt||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&<.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=so(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,lt=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=so(t,"DataView"),jn=so(t,"Map"),Pn=so(t,"Promise"),Sn=so(t,"Set"),An=so(t,"WeakMap"),xn=so(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,s=1&t,l=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!s)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,s);if(p==P||p==d||h&&!o){if(u=l||h?{}:ho(e),!s)return l?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,lo(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,s)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?l?to:eo:l?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function sr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function lr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,s=[],l=t.length;if(!u)return s;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,s=u,l=r(u),c=1/0,f=[];s--;){var p=e[s];s&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),l[s]=!n&&(t||a>=120&&p.length>=120)?new Gn(s&&p):i}p=e[0];var h=-1,b=l[0];e:for(;++h=u?s:s*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,s,1),Ke.call(e,s,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):si(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,ns),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,s=e;null!=s&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var l=t?null:Gi(e);if(l)return sn(l);a=!1,i=Zt,s=new Gn}else s=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,s=null===t,l=t==t,c=uu(t);if(!s&&!c&&!a&&e>t||a&&u&&l&&!s&&!c||r&&u&&l||!n&&l||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!s&&"wrapper"==ro(u))var s=new Fn([],!0)}for(r=s?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof l&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?ts))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=lt||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,l,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=s}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=s}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,s,l,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,s=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);l=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return l=i,b&&r?d(e):(r=a=i,s)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(l===i)return function(e){return f=e,l=Eo(y,t),p?d(e):s}(c);if(h)return _i(l),l=Eo(y,t),d(c)}return l===i&&(l=Eo(y,t)),s}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){l!==i&&_i(l),f=0,r=c=a=l=i},_.flush=function(){return l===i?s:g(Sa())},_}var Ia=Kr((function(e,t){return sr(e,1,t)})),ka=Kr((function(e,t,n){return sr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||ds,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var su=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},lu=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?sn:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?st(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)si(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(se)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var es=Ri(),ts=Ri(!0);function ns(e){return e}function rs(e){return Nr("function"==typeof e?e:ar(e,1))}var is=Kr((function(e,t){return function(n){return Er(n,e,t)}})),os=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function as(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function us(){}var ss=Bi(It),ls=Bi(xt),cs=Bi(Dt);function fs(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var ps=Ui(),hs=Ui(!0);function bs(){return[]}function ds(){return!1}var vs,ys=zi((function(e,t){return e+t}),0),gs=Hi("ceil"),_s=zi((function(e,t){return e/t}),1),ms=Hi("floor"),ws=zi((function(e,t){return e*t}),1),Os=Hi("round"),js=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,s=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||su(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||si(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:li(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:li(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=sa,Ln.zip=la,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,as(Ln,Ln),Ln.add=ys,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gs,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_s,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ms,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=ns,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=su,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=lu,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,ns,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,ns)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,ns,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bs,Ln.stubFalse=ds,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=ws,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=us,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var s=n-cn(r);if(s<1)return r;var l=u?gi(u,0,s).join(""):e.slice(0,s);if(o===i)return l+r;if(u&&(s+=l.length-s),iu(o)){if(e.slice(s).search(o)){var c,f=l;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;l=l.slice(0,p===i?s:p)}}else if(e.indexOf(ai(o),s)!=s){var h=l.lastIndexOf(o);h>-1&&(l=l.slice(0,h))}return l+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,as(Ln,(vs={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vs[t]=e)})),vs),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(ns)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,s=t instanceof Un,l=u[0],c=s||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof l&&1!=l.length&&(s=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=s&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,s=a&&u&&"object"==typeof n.g&&n.g;!s||s.global!==s&&s.window!==s&&s.self!==s||(o=s);var l=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=l)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(l=n)?typeof l[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!l[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),s=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!s?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!s?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var s=t[o];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=n[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)lt(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,s=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var l=Vt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(s,l);e.then(c,n)}e=n,s(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function sn(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=l),an(this)){var o=sn(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return l;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=sn(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!sn(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=ln(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=ln(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=ln(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return lr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return lr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var s=r.value;if(!i.has(s))if(n.delete(s))a=!0;else{var l=n.data_.get(s);o.set(s,l)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!sn(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=ln(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!sn(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=ln(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return lr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=sr(e),t=sr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function sr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function lr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var s=a._childNodes[a.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw li(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var s,l,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(s=r.onError,l=n,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw li(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],si));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw li("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(r),s=!0)}s&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw li(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw li(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw li("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw li("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function lo(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new so(e,t,n||co)}var co=[void 0],fo=lo(eo,void 0),po=lo(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw li("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):lo(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Add 1 object to an array",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=No.model({name:No.string,id:No.string});var n,r;No.model({items:No.array(t)}).actions((e=>({add(t,n){e.items.push({name:t,id:n})}}))).create({items:[]}).add("item-1","id-1"),n="Add 1 object to an array",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[n]?Ro[n]=Math.max(Ro[n],r):Ro[n]=r})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/add-1-object-to-an-array-web-bundle.js.LICENSE.txt b/build/add-1-object-to-an-array-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/add-1-object-to-an-array-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/add-10-objects-to-an-array-bundle-source.js b/build/add-10-objects-to-an-array-bundle-source.js new file mode 100644 index 0000000..1a605d4 --- /dev/null +++ b/build/add-10-objects-to-an-array-bundle-source.js @@ -0,0 +1,106 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Add 10 objects to an array", () => { + const startMemory = getStartMemory(); + const SampleModel = types.model({ + name: types.string, + id: types.string, +}); + +const SampleStore = types + .model({ + items: types.array(SampleModel), + }) + .actions((self) => ({ + add(name, id) { + self.items.push({ name, id }); + }, + })); + +/** + * Requested by the community in https://github.com/coolsoftwaretyler/mst-performance-testing/issues/26 + */ +const store = SampleStore.create({ items: [] }); +for (let i = 0; i < 10; i++) { + store.add(`item-${i}`, `id-${i}`); +} + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Add 10 objects to an array", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/add-10-objects-to-an-array-node-bundle.js b/build/add-10-objects-to-an-array-node-bundle.js new file mode 100644 index 0000000..abf3417 --- /dev/null +++ b/build/add-10-objects-to-an-array-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see add-10-objects-to-an-array-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Vt(e){return v(e)&&!0===e.isMobxAction}function Ct(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Vr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Vr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Vr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Vr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Ct((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Vr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Vr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},C(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Vr=P("ObservableMap",Nr),Cr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Cr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Vr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Vr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Vi?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Vi&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Cn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Vn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Cn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Vn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Va=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Ca={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Ci(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Add 10 objects to an array",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=Ca.model({name:Ca.string,id:Ca.string}),r=Ca.model({items:Ca.array(t)}).actions((e=>({add(t,r){e.items.push({name:t,id:r})}}))).create({items:[]});for(let e=0;e<10;e++)r.add(`item-${e}`,`id-${e}`);var n,i;n="Add 10 objects to an array",i=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[n]?ka[n]=Math.max(ka[n],i):ka[n]=i})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/add-10-objects-to-an-array-node-bundle.js.LICENSE.txt b/build/add-10-objects-to-an-array-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/add-10-objects-to-an-array-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/add-10-objects-to-an-array-web-bundle.js b/build/add-10-objects-to-an-array-web-bundle.js new file mode 100644 index 0000000..d09742b --- /dev/null +++ b/build/add-10-objects-to-an-array-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see add-10-objects-to-an-array-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,s=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),l=a.object&&e&&!e.nodeType&&e,c=s&&l&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(l&&l.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,l=e.Object,c=(e.RegExp,e.String),_=[],m=l.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,le(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=s&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,s={currentTarget:e},l={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),s.type="cycle",s.target=r,n=W(s),l.onCycle.call(e,n),n.aborted||!1===b())s.type="complete",l.onComplete.call(e,W(s));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function se(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function le(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,s=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+s+")"),fnArg:s,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}le=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,s=Z(u.fn),l=u.count=i.count,f=s||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||s);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=l)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=l}if(!v&&!a&&!y){v=o(u,f,a,d=(s||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=l,delete i.error}catch(e){u.count=l,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),le.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,s,l,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:le(t),l=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((s=W("error")).message=t.error,t.emit(s),s.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==l?1:-1:0):f<=(u<5||s<3?0:y[u][s-3])?f==l?1:-1:0},emit:oe,listeners:ae,off:ue,on:se,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,s=u.destination,l=s[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(l)||(r=!0,l=[]),l.length!=e.length&&(r=!0,(l=l.slice(0,e.length)).length=e.length)):t.isObjectLike(l)||(r=!0,l={}),r&&i.push({destination:s,key:n,value:l}),a.push({destination:l,source:e})):t.eq(l,e)||e===o||i.push({destination:s,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,s=[],l=e.stats.sample;function c(){s.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(s,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=l.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=l.length=s.length=0)),_||(f=q(l),y=t.reduce(l,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),s.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",s=32,l=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",l],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",s],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,se=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,le=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,st=parseInt,lt="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=lt||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&<.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=so(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,lt=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=so(t,"DataView"),jn=so(t,"Map"),Pn=so(t,"Promise"),Sn=so(t,"Set"),An=so(t,"WeakMap"),xn=so(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,s=1&t,l=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!s)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,s);if(p==P||p==d||h&&!o){if(u=l||h?{}:ho(e),!s)return l?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,lo(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,s)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?l?to:eo:l?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function sr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function lr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,s=[],l=t.length;if(!u)return s;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,s=u,l=r(u),c=1/0,f=[];s--;){var p=e[s];s&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),l[s]=!n&&(t||a>=120&&p.length>=120)?new Gn(s&&p):i}p=e[0];var h=-1,b=l[0];e:for(;++h=u?s:s*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,s,1),Ke.call(e,s,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):si(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,ns),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,s=e;null!=s&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var l=t?null:Gi(e);if(l)return sn(l);a=!1,i=Zt,s=new Gn}else s=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,s=null===t,l=t==t,c=uu(t);if(!s&&!c&&!a&&e>t||a&&u&&l&&!s&&!c||r&&u&&l||!n&&l||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!s&&"wrapper"==ro(u))var s=new Fn([],!0)}for(r=s?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof l&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?ts))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=lt||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,l,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=s}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=s}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,s,l,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,s=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);l=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return l=i,b&&r?d(e):(r=a=i,s)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(l===i)return function(e){return f=e,l=Eo(y,t),p?d(e):s}(c);if(h)return _i(l),l=Eo(y,t),d(c)}return l===i&&(l=Eo(y,t)),s}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){l!==i&&_i(l),f=0,r=c=a=l=i},_.flush=function(){return l===i?s:g(Sa())},_}var Ia=Kr((function(e,t){return sr(e,1,t)})),ka=Kr((function(e,t,n){return sr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||ds,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var su=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},lu=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?sn:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?st(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)si(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(se)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var es=Ri(),ts=Ri(!0);function ns(e){return e}function rs(e){return Nr("function"==typeof e?e:ar(e,1))}var is=Kr((function(e,t){return function(n){return Er(n,e,t)}})),os=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function as(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function us(){}var ss=Bi(It),ls=Bi(xt),cs=Bi(Dt);function fs(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var ps=Ui(),hs=Ui(!0);function bs(){return[]}function ds(){return!1}var vs,ys=zi((function(e,t){return e+t}),0),gs=Hi("ceil"),_s=zi((function(e,t){return e/t}),1),ms=Hi("floor"),ws=zi((function(e,t){return e*t}),1),Os=Hi("round"),js=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,s=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||su(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||si(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:li(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:li(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=sa,Ln.zip=la,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,as(Ln,Ln),Ln.add=ys,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gs,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_s,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ms,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=ns,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=su,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=lu,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,ns,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,ns)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,ns,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bs,Ln.stubFalse=ds,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=ws,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=us,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var s=n-cn(r);if(s<1)return r;var l=u?gi(u,0,s).join(""):e.slice(0,s);if(o===i)return l+r;if(u&&(s+=l.length-s),iu(o)){if(e.slice(s).search(o)){var c,f=l;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;l=l.slice(0,p===i?s:p)}}else if(e.indexOf(ai(o),s)!=s){var h=l.lastIndexOf(o);h>-1&&(l=l.slice(0,h))}return l+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,as(Ln,(vs={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vs[t]=e)})),vs),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(ns)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,s=t instanceof Un,l=u[0],c=s||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof l&&1!=l.length&&(s=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=s&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,s=a&&u&&"object"==typeof n.g&&n.g;!s||s.global!==s&&s.window!==s&&s.self!==s||(o=s);var l=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=l)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(l=n)?typeof l[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!l[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),s=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!s?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!s?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var s=t[o];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=n[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)lt(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,s=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var l=Vt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(s,l);e.then(c,n)}e=n,s(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function sn(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=l),an(this)){var o=sn(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return l;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=sn(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!sn(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=ln(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=ln(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=ln(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return lr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return lr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var s=r.value;if(!i.has(s))if(n.delete(s))a=!0;else{var l=n.data_.get(s);o.set(s,l)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!sn(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=ln(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!sn(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=ln(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return lr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=sr(e),t=sr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function sr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function lr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var s=a._childNodes[a.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw li(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var s,l,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(s=r.onError,l=n,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw li(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],si));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw li("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(r),s=!0)}s&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw li(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw li(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw li("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw li("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function lo(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new so(e,t,n||co)}var co=[void 0],fo=lo(eo,void 0),po=lo(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw li("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):lo(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Add 10 objects to an array",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=No.model({name:No.string,id:No.string}),n=No.model({items:No.array(t)}).actions((e=>({add(t,n){e.items.push({name:t,id:n})}}))).create({items:[]});for(let e=0;e<10;e++)n.add(`item-${e}`,`id-${e}`);var r,i;r="Add 10 objects to an array",i=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[r]?Ro[r]=Math.max(Ro[r],i):Ro[r]=i})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/add-10-objects-to-an-array-web-bundle.js.LICENSE.txt b/build/add-10-objects-to-an-array-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/add-10-objects-to-an-array-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/add-100-objects-to-an-array-bundle-source.js b/build/add-100-objects-to-an-array-bundle-source.js new file mode 100644 index 0000000..2003d65 --- /dev/null +++ b/build/add-100-objects-to-an-array-bundle-source.js @@ -0,0 +1,106 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Add 100 objects to an array", () => { + const startMemory = getStartMemory(); + const SampleModel = types.model({ + name: types.string, + id: types.string, +}); + +const SampleStore = types + .model({ + items: types.array(SampleModel), + }) + .actions((self) => ({ + add(name, id) { + self.items.push({ name, id }); + }, + })); + +/** + * Requested by the community in https://github.com/coolsoftwaretyler/mst-performance-testing/issues/26 + */ +const store = SampleStore.create({ items: [] }); +for (let i = 0; i < 100; i++) { + store.add(`item-${i}`, `id-${i}`); +} + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Add 100 objects to an array", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/add-100-objects-to-an-array-node-bundle.js b/build/add-100-objects-to-an-array-node-bundle.js new file mode 100644 index 0000000..66d3d48 --- /dev/null +++ b/build/add-100-objects-to-an-array-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see add-100-objects-to-an-array-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Vt(e){return v(e)&&!0===e.isMobxAction}function Ct(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Vr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Vr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Vr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Vr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Ct((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Vr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Vr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},C(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Vr=P("ObservableMap",Nr),Cr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Cr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Vr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Vr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Vi?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Vi&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Cn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Vn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Cn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Vn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Va=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Ca={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Ci(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Add 100 objects to an array",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=Ca.model({name:Ca.string,id:Ca.string}),r=Ca.model({items:Ca.array(t)}).actions((e=>({add(t,r){e.items.push({name:t,id:r})}}))).create({items:[]});for(let e=0;e<100;e++)r.add(`item-${e}`,`id-${e}`);var n,i;n="Add 100 objects to an array",i=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[n]?ka[n]=Math.max(ka[n],i):ka[n]=i})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/add-100-objects-to-an-array-node-bundle.js.LICENSE.txt b/build/add-100-objects-to-an-array-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/add-100-objects-to-an-array-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/add-100-objects-to-an-array-web-bundle.js b/build/add-100-objects-to-an-array-web-bundle.js new file mode 100644 index 0000000..c7748b5 --- /dev/null +++ b/build/add-100-objects-to-an-array-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see add-100-objects-to-an-array-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,s=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),l=a.object&&e&&!e.nodeType&&e,c=s&&l&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(l&&l.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,l=e.Object,c=(e.RegExp,e.String),_=[],m=l.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,le(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=s&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,s={currentTarget:e},l={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),s.type="cycle",s.target=r,n=W(s),l.onCycle.call(e,n),n.aborted||!1===b())s.type="complete",l.onComplete.call(e,W(s));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function se(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function le(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,s=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+s+")"),fnArg:s,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}le=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,s=Z(u.fn),l=u.count=i.count,f=s||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||s);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=l)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=l}if(!v&&!a&&!y){v=o(u,f,a,d=(s||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=l,delete i.error}catch(e){u.count=l,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),le.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,s,l,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:le(t),l=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((s=W("error")).message=t.error,t.emit(s),s.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==l?1:-1:0):f<=(u<5||s<3?0:y[u][s-3])?f==l?1:-1:0},emit:oe,listeners:ae,off:ue,on:se,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,s=u.destination,l=s[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(l)||(r=!0,l=[]),l.length!=e.length&&(r=!0,(l=l.slice(0,e.length)).length=e.length)):t.isObjectLike(l)||(r=!0,l={}),r&&i.push({destination:s,key:n,value:l}),a.push({destination:l,source:e})):t.eq(l,e)||e===o||i.push({destination:s,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,s=[],l=e.stats.sample;function c(){s.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(s,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=l.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=l.length=s.length=0)),_||(f=q(l),y=t.reduce(l,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),s.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",s=32,l=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",l],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",s],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,se=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,le=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,st=parseInt,lt="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=lt||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&<.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=so(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,lt=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=so(t,"DataView"),jn=so(t,"Map"),Pn=so(t,"Promise"),Sn=so(t,"Set"),An=so(t,"WeakMap"),xn=so(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,s=1&t,l=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!s)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,s);if(p==P||p==d||h&&!o){if(u=l||h?{}:ho(e),!s)return l?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,lo(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,s)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?l?to:eo:l?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function sr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function lr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,s=[],l=t.length;if(!u)return s;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,s=u,l=r(u),c=1/0,f=[];s--;){var p=e[s];s&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),l[s]=!n&&(t||a>=120&&p.length>=120)?new Gn(s&&p):i}p=e[0];var h=-1,b=l[0];e:for(;++h=u?s:s*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,s,1),Ke.call(e,s,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):si(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,ns),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,s=e;null!=s&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var l=t?null:Gi(e);if(l)return sn(l);a=!1,i=Zt,s=new Gn}else s=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,s=null===t,l=t==t,c=uu(t);if(!s&&!c&&!a&&e>t||a&&u&&l&&!s&&!c||r&&u&&l||!n&&l||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!s&&"wrapper"==ro(u))var s=new Fn([],!0)}for(r=s?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof l&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?ts))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=lt||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,l,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=s}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=s}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,s,l,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,s=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);l=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return l=i,b&&r?d(e):(r=a=i,s)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(l===i)return function(e){return f=e,l=Eo(y,t),p?d(e):s}(c);if(h)return _i(l),l=Eo(y,t),d(c)}return l===i&&(l=Eo(y,t)),s}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){l!==i&&_i(l),f=0,r=c=a=l=i},_.flush=function(){return l===i?s:g(Sa())},_}var Ia=Kr((function(e,t){return sr(e,1,t)})),ka=Kr((function(e,t,n){return sr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||ds,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var su=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},lu=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?sn:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?st(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)si(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(se)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var es=Ri(),ts=Ri(!0);function ns(e){return e}function rs(e){return Nr("function"==typeof e?e:ar(e,1))}var is=Kr((function(e,t){return function(n){return Er(n,e,t)}})),os=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function as(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function us(){}var ss=Bi(It),ls=Bi(xt),cs=Bi(Dt);function fs(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var ps=Ui(),hs=Ui(!0);function bs(){return[]}function ds(){return!1}var vs,ys=zi((function(e,t){return e+t}),0),gs=Hi("ceil"),_s=zi((function(e,t){return e/t}),1),ms=Hi("floor"),ws=zi((function(e,t){return e*t}),1),Os=Hi("round"),js=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,s=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||su(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||si(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:li(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:li(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=sa,Ln.zip=la,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,as(Ln,Ln),Ln.add=ys,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gs,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_s,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ms,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=ns,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=su,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=lu,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,ns,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,ns)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,ns,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bs,Ln.stubFalse=ds,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=ws,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=us,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var s=n-cn(r);if(s<1)return r;var l=u?gi(u,0,s).join(""):e.slice(0,s);if(o===i)return l+r;if(u&&(s+=l.length-s),iu(o)){if(e.slice(s).search(o)){var c,f=l;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;l=l.slice(0,p===i?s:p)}}else if(e.indexOf(ai(o),s)!=s){var h=l.lastIndexOf(o);h>-1&&(l=l.slice(0,h))}return l+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,as(Ln,(vs={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vs[t]=e)})),vs),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(ns)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,s=t instanceof Un,l=u[0],c=s||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof l&&1!=l.length&&(s=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=s&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,s=a&&u&&"object"==typeof n.g&&n.g;!s||s.global!==s&&s.window!==s&&s.self!==s||(o=s);var l=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=l)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(l=n)?typeof l[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!l[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),s=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!s?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!s?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var s=t[o];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=n[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)lt(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,s=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var l=Vt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(s,l);e.then(c,n)}e=n,s(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function sn(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=l),an(this)){var o=sn(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return l;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=sn(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!sn(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=ln(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=ln(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=ln(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return lr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return lr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var s=r.value;if(!i.has(s))if(n.delete(s))a=!0;else{var l=n.data_.get(s);o.set(s,l)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!sn(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=ln(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!sn(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=ln(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return lr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=sr(e),t=sr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function sr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function lr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var s=a._childNodes[a.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw li(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var s,l,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(s=r.onError,l=n,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw li(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],si));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw li("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(r),s=!0)}s&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw li(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw li(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw li("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw li("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function lo(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new so(e,t,n||co)}var co=[void 0],fo=lo(eo,void 0),po=lo(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw li("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):lo(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Add 100 objects to an array",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=No.model({name:No.string,id:No.string}),n=No.model({items:No.array(t)}).actions((e=>({add(t,n){e.items.push({name:t,id:n})}}))).create({items:[]});for(let e=0;e<100;e++)n.add(`item-${e}`,`id-${e}`);var r,i;r="Add 100 objects to an array",i=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[r]?Ro[r]=Math.max(Ro[r],i):Ro[r]=i})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/add-100-objects-to-an-array-web-bundle.js.LICENSE.txt b/build/add-100-objects-to-an-array-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/add-100-objects-to-an-array-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/add-1000-objects-to-an-array-bundle-source.js b/build/add-1000-objects-to-an-array-bundle-source.js new file mode 100644 index 0000000..bbfec5e --- /dev/null +++ b/build/add-1000-objects-to-an-array-bundle-source.js @@ -0,0 +1,106 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Add 1000 objects to an array", () => { + const startMemory = getStartMemory(); + const SampleModel = types.model({ + name: types.string, + id: types.string, +}); + +const SampleStore = types + .model({ + items: types.array(SampleModel), + }) + .actions((self) => ({ + add(name, id) { + self.items.push({ name, id }); + }, + })); + +/** + * Requested by the community in https://github.com/coolsoftwaretyler/mst-performance-testing/issues/26 + */ +const store = SampleStore.create({ items: [] }); +for (let i = 0; i < 1000; i++) { + store.add(`item-${i}`, `id-${i}`); +} + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Add 1000 objects to an array", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/add-1000-objects-to-an-array-node-bundle.js b/build/add-1000-objects-to-an-array-node-bundle.js new file mode 100644 index 0000000..fbb13a2 --- /dev/null +++ b/build/add-1000-objects-to-an-array-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see add-1000-objects-to-an-array-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Vt(e){return v(e)&&!0===e.isMobxAction}function Ct(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Vr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Vr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Vr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Vr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Ct((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Vr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Vr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},C(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Vr=P("ObservableMap",Nr),Cr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Cr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Vr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Vr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Vi?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Vi&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Cn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Vn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Cn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Vn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Va=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Ca={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Ci(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Add 1000 objects to an array",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=Ca.model({name:Ca.string,id:Ca.string}),r=Ca.model({items:Ca.array(t)}).actions((e=>({add(t,r){e.items.push({name:t,id:r})}}))).create({items:[]});for(let e=0;e<1e3;e++)r.add(`item-${e}`,`id-${e}`);var n,i;n="Add 1000 objects to an array",i=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[n]?ka[n]=Math.max(ka[n],i):ka[n]=i})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/add-1000-objects-to-an-array-node-bundle.js.LICENSE.txt b/build/add-1000-objects-to-an-array-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/add-1000-objects-to-an-array-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/add-1000-objects-to-an-array-web-bundle.js b/build/add-1000-objects-to-an-array-web-bundle.js new file mode 100644 index 0000000..789f857 --- /dev/null +++ b/build/add-1000-objects-to-an-array-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see add-1000-objects-to-an-array-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,s=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),l=a.object&&e&&!e.nodeType&&e,c=s&&l&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(l&&l.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,l=e.Object,c=(e.RegExp,e.String),_=[],m=l.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,le(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=s&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,s={currentTarget:e},l={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),s.type="cycle",s.target=r,n=W(s),l.onCycle.call(e,n),n.aborted||!1===b())s.type="complete",l.onComplete.call(e,W(s));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function se(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function le(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,s=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+s+")"),fnArg:s,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}le=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,s=Z(u.fn),l=u.count=i.count,f=s||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||s);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=l)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=l}if(!v&&!a&&!y){v=o(u,f,a,d=(s||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=l,delete i.error}catch(e){u.count=l,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),le.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,s,l,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:le(t),l=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((s=W("error")).message=t.error,t.emit(s),s.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==l?1:-1:0):f<=(u<5||s<3?0:y[u][s-3])?f==l?1:-1:0},emit:oe,listeners:ae,off:ue,on:se,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,s=u.destination,l=s[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(l)||(r=!0,l=[]),l.length!=e.length&&(r=!0,(l=l.slice(0,e.length)).length=e.length)):t.isObjectLike(l)||(r=!0,l={}),r&&i.push({destination:s,key:n,value:l}),a.push({destination:l,source:e})):t.eq(l,e)||e===o||i.push({destination:s,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,s=[],l=e.stats.sample;function c(){s.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(s,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=l.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=l.length=s.length=0)),_||(f=q(l),y=t.reduce(l,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),s.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",s=32,l=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",l],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",s],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,se=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,le=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,st=parseInt,lt="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=lt||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&<.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=so(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,lt=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=so(t,"DataView"),jn=so(t,"Map"),Pn=so(t,"Promise"),Sn=so(t,"Set"),An=so(t,"WeakMap"),xn=so(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,s=1&t,l=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!s)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,s);if(p==P||p==d||h&&!o){if(u=l||h?{}:ho(e),!s)return l?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,lo(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,s)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?l?to:eo:l?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function sr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function lr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,s=[],l=t.length;if(!u)return s;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,s=u,l=r(u),c=1/0,f=[];s--;){var p=e[s];s&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),l[s]=!n&&(t||a>=120&&p.length>=120)?new Gn(s&&p):i}p=e[0];var h=-1,b=l[0];e:for(;++h=u?s:s*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,s,1),Ke.call(e,s,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):si(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,ns),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,s=e;null!=s&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var l=t?null:Gi(e);if(l)return sn(l);a=!1,i=Zt,s=new Gn}else s=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,s=null===t,l=t==t,c=uu(t);if(!s&&!c&&!a&&e>t||a&&u&&l&&!s&&!c||r&&u&&l||!n&&l||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!s&&"wrapper"==ro(u))var s=new Fn([],!0)}for(r=s?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof l&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?ts))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=lt||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,l,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=s}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=s}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,s,l,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,s=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);l=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return l=i,b&&r?d(e):(r=a=i,s)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(l===i)return function(e){return f=e,l=Eo(y,t),p?d(e):s}(c);if(h)return _i(l),l=Eo(y,t),d(c)}return l===i&&(l=Eo(y,t)),s}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){l!==i&&_i(l),f=0,r=c=a=l=i},_.flush=function(){return l===i?s:g(Sa())},_}var Ia=Kr((function(e,t){return sr(e,1,t)})),ka=Kr((function(e,t,n){return sr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||ds,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var su=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},lu=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?sn:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?st(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)si(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(se)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var es=Ri(),ts=Ri(!0);function ns(e){return e}function rs(e){return Nr("function"==typeof e?e:ar(e,1))}var is=Kr((function(e,t){return function(n){return Er(n,e,t)}})),os=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function as(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function us(){}var ss=Bi(It),ls=Bi(xt),cs=Bi(Dt);function fs(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var ps=Ui(),hs=Ui(!0);function bs(){return[]}function ds(){return!1}var vs,ys=zi((function(e,t){return e+t}),0),gs=Hi("ceil"),_s=zi((function(e,t){return e/t}),1),ms=Hi("floor"),ws=zi((function(e,t){return e*t}),1),Os=Hi("round"),js=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,s=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||su(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||si(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:li(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:li(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=sa,Ln.zip=la,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,as(Ln,Ln),Ln.add=ys,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gs,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_s,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ms,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=ns,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=su,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=lu,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,ns,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,ns)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,ns,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bs,Ln.stubFalse=ds,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=ws,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=us,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var s=n-cn(r);if(s<1)return r;var l=u?gi(u,0,s).join(""):e.slice(0,s);if(o===i)return l+r;if(u&&(s+=l.length-s),iu(o)){if(e.slice(s).search(o)){var c,f=l;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;l=l.slice(0,p===i?s:p)}}else if(e.indexOf(ai(o),s)!=s){var h=l.lastIndexOf(o);h>-1&&(l=l.slice(0,h))}return l+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,as(Ln,(vs={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vs[t]=e)})),vs),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(ns)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,s=t instanceof Un,l=u[0],c=s||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof l&&1!=l.length&&(s=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=s&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,s=a&&u&&"object"==typeof n.g&&n.g;!s||s.global!==s&&s.window!==s&&s.self!==s||(o=s);var l=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=l)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(l=n)?typeof l[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!l[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),s=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!s?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!s?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var s=t[o];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=n[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)lt(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,s=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var l=Vt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(s,l);e.then(c,n)}e=n,s(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function sn(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=l),an(this)){var o=sn(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return l;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=sn(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!sn(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=ln(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=ln(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=ln(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return lr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return lr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var s=r.value;if(!i.has(s))if(n.delete(s))a=!0;else{var l=n.data_.get(s);o.set(s,l)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!sn(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=ln(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!sn(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=ln(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return lr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=sr(e),t=sr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function sr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function lr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var s=a._childNodes[a.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw li(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var s,l,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(s=r.onError,l=n,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw li(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],si));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw li("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(r),s=!0)}s&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw li(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw li(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw li("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw li("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function lo(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new so(e,t,n||co)}var co=[void 0],fo=lo(eo,void 0),po=lo(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw li("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):lo(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Add 1000 objects to an array",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=No.model({name:No.string,id:No.string}),n=No.model({items:No.array(t)}).actions((e=>({add(t,n){e.items.push({name:t,id:n})}}))).create({items:[]});for(let e=0;e<1e3;e++)n.add(`item-${e}`,`id-${e}`);var r,i;r="Add 1000 objects to an array",i=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[r]?Ro[r]=Math.max(Ro[r],i):Ro[r]=i})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/add-1000-objects-to-an-array-web-bundle.js.LICENSE.txt b/build/add-1000-objects-to-an-array-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/add-1000-objects-to-an-array-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/add-10000-objects-to-an-array-bundle-source.js b/build/add-10000-objects-to-an-array-bundle-source.js new file mode 100644 index 0000000..edf65a7 --- /dev/null +++ b/build/add-10000-objects-to-an-array-bundle-source.js @@ -0,0 +1,106 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Add 10000 objects to an array", () => { + const startMemory = getStartMemory(); + const SampleModel = types.model({ + name: types.string, + id: types.string, +}); + +const SampleStore = types + .model({ + items: types.array(SampleModel), + }) + .actions((self) => ({ + add(name, id) { + self.items.push({ name, id }); + }, + })); + +/** + * Requested by the community in https://github.com/coolsoftwaretyler/mst-performance-testing/issues/26 + */ +const store = SampleStore.create({ items: [] }); +for (let i = 0; i < 10000; i++) { + store.add(`item-${i}`, `id-${i}`); +} + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Add 10000 objects to an array", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/add-10000-objects-to-an-array-node-bundle.js b/build/add-10000-objects-to-an-array-node-bundle.js new file mode 100644 index 0000000..7d34939 --- /dev/null +++ b/build/add-10000-objects-to-an-array-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see add-10000-objects-to-an-array-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Vt(e){return v(e)&&!0===e.isMobxAction}function Ct(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Vr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Vr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Vr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Vr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Ct((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Vr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Vr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},C(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Vr=P("ObservableMap",Nr),Cr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Cr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Vr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Vr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Vi?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Vi&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Cn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Vn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Cn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Vn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Va=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Ca={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Ci(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Add 10000 objects to an array",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=Ca.model({name:Ca.string,id:Ca.string}),r=Ca.model({items:Ca.array(t)}).actions((e=>({add(t,r){e.items.push({name:t,id:r})}}))).create({items:[]});for(let e=0;e<1e4;e++)r.add(`item-${e}`,`id-${e}`);var n,i;n="Add 10000 objects to an array",i=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[n]?ka[n]=Math.max(ka[n],i):ka[n]=i})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/add-10000-objects-to-an-array-node-bundle.js.LICENSE.txt b/build/add-10000-objects-to-an-array-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/add-10000-objects-to-an-array-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/add-10000-objects-to-an-array-web-bundle.js b/build/add-10000-objects-to-an-array-web-bundle.js new file mode 100644 index 0000000..a44148b --- /dev/null +++ b/build/add-10000-objects-to-an-array-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see add-10000-objects-to-an-array-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,s=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),l=a.object&&e&&!e.nodeType&&e,c=s&&l&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(l&&l.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,l=e.Object,c=(e.RegExp,e.String),_=[],m=l.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,le(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=s&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,s={currentTarget:e},l={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),s.type="cycle",s.target=r,n=W(s),l.onCycle.call(e,n),n.aborted||!1===b())s.type="complete",l.onComplete.call(e,W(s));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function se(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function le(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,s=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+s+")"),fnArg:s,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}le=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,s=Z(u.fn),l=u.count=i.count,f=s||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||s);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=l)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=l}if(!v&&!a&&!y){v=o(u,f,a,d=(s||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=l,delete i.error}catch(e){u.count=l,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),le.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,s,l,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:le(t),l=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((s=W("error")).message=t.error,t.emit(s),s.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==l?1:-1:0):f<=(u<5||s<3?0:y[u][s-3])?f==l?1:-1:0},emit:oe,listeners:ae,off:ue,on:se,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,s=u.destination,l=s[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(l)||(r=!0,l=[]),l.length!=e.length&&(r=!0,(l=l.slice(0,e.length)).length=e.length)):t.isObjectLike(l)||(r=!0,l={}),r&&i.push({destination:s,key:n,value:l}),a.push({destination:l,source:e})):t.eq(l,e)||e===o||i.push({destination:s,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,s=[],l=e.stats.sample;function c(){s.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(s,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=l.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=l.length=s.length=0)),_||(f=q(l),y=t.reduce(l,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),s.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",s=32,l=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",l],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",s],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,se=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,le=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,st=parseInt,lt="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=lt||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&<.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=so(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,lt=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=so(t,"DataView"),jn=so(t,"Map"),Pn=so(t,"Promise"),Sn=so(t,"Set"),An=so(t,"WeakMap"),xn=so(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,s=1&t,l=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!s)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,s);if(p==P||p==d||h&&!o){if(u=l||h?{}:ho(e),!s)return l?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,lo(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,s)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?l?to:eo:l?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function sr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function lr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,s=[],l=t.length;if(!u)return s;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,s=u,l=r(u),c=1/0,f=[];s--;){var p=e[s];s&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),l[s]=!n&&(t||a>=120&&p.length>=120)?new Gn(s&&p):i}p=e[0];var h=-1,b=l[0];e:for(;++h=u?s:s*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,s,1),Ke.call(e,s,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):si(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,ns),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,s=e;null!=s&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var l=t?null:Gi(e);if(l)return sn(l);a=!1,i=Zt,s=new Gn}else s=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,s=null===t,l=t==t,c=uu(t);if(!s&&!c&&!a&&e>t||a&&u&&l&&!s&&!c||r&&u&&l||!n&&l||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!s&&"wrapper"==ro(u))var s=new Fn([],!0)}for(r=s?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof l&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?ts))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=lt||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,l,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=s}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=s}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,s,l,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,s=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);l=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return l=i,b&&r?d(e):(r=a=i,s)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(l===i)return function(e){return f=e,l=Eo(y,t),p?d(e):s}(c);if(h)return _i(l),l=Eo(y,t),d(c)}return l===i&&(l=Eo(y,t)),s}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){l!==i&&_i(l),f=0,r=c=a=l=i},_.flush=function(){return l===i?s:g(Sa())},_}var Ia=Kr((function(e,t){return sr(e,1,t)})),ka=Kr((function(e,t,n){return sr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||ds,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var su=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},lu=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?sn:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?st(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)si(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(se)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var es=Ri(),ts=Ri(!0);function ns(e){return e}function rs(e){return Nr("function"==typeof e?e:ar(e,1))}var is=Kr((function(e,t){return function(n){return Er(n,e,t)}})),os=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function as(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function us(){}var ss=Bi(It),ls=Bi(xt),cs=Bi(Dt);function fs(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var ps=Ui(),hs=Ui(!0);function bs(){return[]}function ds(){return!1}var vs,ys=zi((function(e,t){return e+t}),0),gs=Hi("ceil"),_s=zi((function(e,t){return e/t}),1),ms=Hi("floor"),ws=zi((function(e,t){return e*t}),1),Os=Hi("round"),js=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,s=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||su(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||si(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:li(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:li(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=sa,Ln.zip=la,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,as(Ln,Ln),Ln.add=ys,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gs,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_s,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ms,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=ns,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=su,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=lu,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,ns,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,ns)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,ns,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bs,Ln.stubFalse=ds,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=ws,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=us,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var s=n-cn(r);if(s<1)return r;var l=u?gi(u,0,s).join(""):e.slice(0,s);if(o===i)return l+r;if(u&&(s+=l.length-s),iu(o)){if(e.slice(s).search(o)){var c,f=l;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;l=l.slice(0,p===i?s:p)}}else if(e.indexOf(ai(o),s)!=s){var h=l.lastIndexOf(o);h>-1&&(l=l.slice(0,h))}return l+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,as(Ln,(vs={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vs[t]=e)})),vs),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(ns)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,s=t instanceof Un,l=u[0],c=s||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof l&&1!=l.length&&(s=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=s&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,s=a&&u&&"object"==typeof n.g&&n.g;!s||s.global!==s&&s.window!==s&&s.self!==s||(o=s);var l=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=l)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(l=n)?typeof l[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!l[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),s=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!s?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!s?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var s=t[o];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=n[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)lt(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,s=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var l=Vt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(s,l);e.then(c,n)}e=n,s(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function sn(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=l),an(this)){var o=sn(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return l;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=sn(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!sn(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=ln(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=ln(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=ln(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return lr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return lr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var s=r.value;if(!i.has(s))if(n.delete(s))a=!0;else{var l=n.data_.get(s);o.set(s,l)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!sn(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=ln(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!sn(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=ln(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return lr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=sr(e),t=sr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function sr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function lr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var s=a._childNodes[a.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw li(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var s,l,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(s=r.onError,l=n,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw li(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],si));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw li("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(r),s=!0)}s&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw li(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw li(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw li("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw li("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function lo(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new so(e,t,n||co)}var co=[void 0],fo=lo(eo,void 0),po=lo(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw li("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):lo(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Add 10000 objects to an array",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=No.model({name:No.string,id:No.string}),n=No.model({items:No.array(t)}).actions((e=>({add(t,n){e.items.push({name:t,id:n})}}))).create({items:[]});for(let e=0;e<1e4;e++)n.add(`item-${e}`,`id-${e}`);var r,i;r="Add 10000 objects to an array",i=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[r]?Ro[r]=Math.max(Ro[r],i):Ro[r]=i})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/add-10000-objects-to-an-array-web-bundle.js.LICENSE.txt b/build/add-10000-objects-to-an-array-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/add-10000-objects-to-an-array-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/add-100000-objects-to-an-array-bundle-source.js b/build/add-100000-objects-to-an-array-bundle-source.js new file mode 100644 index 0000000..3d8ca74 --- /dev/null +++ b/build/add-100000-objects-to-an-array-bundle-source.js @@ -0,0 +1,106 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Add 100000 objects to an array", () => { + const startMemory = getStartMemory(); + const SampleModel = types.model({ + name: types.string, + id: types.string, +}); + +const SampleStore = types + .model({ + items: types.array(SampleModel), + }) + .actions((self) => ({ + add(name, id) { + self.items.push({ name, id }); + }, + })); + +/** + * Requested by the community in https://github.com/coolsoftwaretyler/mst-performance-testing/issues/26 + */ +const store = SampleStore.create({ items: [] }); +for (let i = 0; i < 100000; i++) { + store.add(`item-${i}`, `id-${i}`); +} + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Add 100000 objects to an array", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/add-100000-objects-to-an-array-node-bundle.js b/build/add-100000-objects-to-an-array-node-bundle.js new file mode 100644 index 0000000..8f4ffdd --- /dev/null +++ b/build/add-100000-objects-to-an-array-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see add-100000-objects-to-an-array-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Vt(e){return v(e)&&!0===e.isMobxAction}function Ct(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Vr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Vr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Vr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Vr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Ct((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Vr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Vr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},C(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Vr=P("ObservableMap",Nr),Cr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Cr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Vr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Vr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Vi?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Vi&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Cn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Vn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Cn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Vn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Va=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Ca={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Ci(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Add 100000 objects to an array",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=Ca.model({name:Ca.string,id:Ca.string}),r=Ca.model({items:Ca.array(t)}).actions((e=>({add(t,r){e.items.push({name:t,id:r})}}))).create({items:[]});for(let e=0;e<1e5;e++)r.add(`item-${e}`,`id-${e}`);var n,i;n="Add 100000 objects to an array",i=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[n]?ka[n]=Math.max(ka[n],i):ka[n]=i})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/add-100000-objects-to-an-array-node-bundle.js.LICENSE.txt b/build/add-100000-objects-to-an-array-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/add-100000-objects-to-an-array-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/add-100000-objects-to-an-array-web-bundle.js b/build/add-100000-objects-to-an-array-web-bundle.js new file mode 100644 index 0000000..6e2a616 --- /dev/null +++ b/build/add-100000-objects-to-an-array-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see add-100000-objects-to-an-array-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,s=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),l=a.object&&e&&!e.nodeType&&e,c=s&&l&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(l&&l.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,l=e.Object,c=(e.RegExp,e.String),_=[],m=l.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,le(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=s&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,s={currentTarget:e},l={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),s.type="cycle",s.target=r,n=W(s),l.onCycle.call(e,n),n.aborted||!1===b())s.type="complete",l.onComplete.call(e,W(s));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function se(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function le(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,s=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+s+")"),fnArg:s,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}le=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,s=Z(u.fn),l=u.count=i.count,f=s||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||s);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=l)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=l}if(!v&&!a&&!y){v=o(u,f,a,d=(s||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=l,delete i.error}catch(e){u.count=l,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),le.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,s,l,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:le(t),l=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((s=W("error")).message=t.error,t.emit(s),s.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==l?1:-1:0):f<=(u<5||s<3?0:y[u][s-3])?f==l?1:-1:0},emit:oe,listeners:ae,off:ue,on:se,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,s=u.destination,l=s[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(l)||(r=!0,l=[]),l.length!=e.length&&(r=!0,(l=l.slice(0,e.length)).length=e.length)):t.isObjectLike(l)||(r=!0,l={}),r&&i.push({destination:s,key:n,value:l}),a.push({destination:l,source:e})):t.eq(l,e)||e===o||i.push({destination:s,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,s=[],l=e.stats.sample;function c(){s.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(s,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=l.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=l.length=s.length=0)),_||(f=q(l),y=t.reduce(l,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),s.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",s=32,l=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",l],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",s],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,se=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,le=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,st=parseInt,lt="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=lt||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&<.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=so(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,lt=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=so(t,"DataView"),jn=so(t,"Map"),Pn=so(t,"Promise"),Sn=so(t,"Set"),An=so(t,"WeakMap"),xn=so(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,s=1&t,l=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!s)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,s);if(p==P||p==d||h&&!o){if(u=l||h?{}:ho(e),!s)return l?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,lo(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,s)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?l?to:eo:l?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function sr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function lr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,s=[],l=t.length;if(!u)return s;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,s=u,l=r(u),c=1/0,f=[];s--;){var p=e[s];s&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),l[s]=!n&&(t||a>=120&&p.length>=120)?new Gn(s&&p):i}p=e[0];var h=-1,b=l[0];e:for(;++h=u?s:s*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,s,1),Ke.call(e,s,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):si(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,ns),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,s=e;null!=s&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var l=t?null:Gi(e);if(l)return sn(l);a=!1,i=Zt,s=new Gn}else s=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,s=null===t,l=t==t,c=uu(t);if(!s&&!c&&!a&&e>t||a&&u&&l&&!s&&!c||r&&u&&l||!n&&l||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!s&&"wrapper"==ro(u))var s=new Fn([],!0)}for(r=s?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof l&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?ts))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=lt||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,l,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=s}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=s}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,s,l,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,s=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);l=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return l=i,b&&r?d(e):(r=a=i,s)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(l===i)return function(e){return f=e,l=Eo(y,t),p?d(e):s}(c);if(h)return _i(l),l=Eo(y,t),d(c)}return l===i&&(l=Eo(y,t)),s}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){l!==i&&_i(l),f=0,r=c=a=l=i},_.flush=function(){return l===i?s:g(Sa())},_}var Ia=Kr((function(e,t){return sr(e,1,t)})),ka=Kr((function(e,t,n){return sr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||ds,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var su=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},lu=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?sn:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?st(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)si(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(se)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var es=Ri(),ts=Ri(!0);function ns(e){return e}function rs(e){return Nr("function"==typeof e?e:ar(e,1))}var is=Kr((function(e,t){return function(n){return Er(n,e,t)}})),os=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function as(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function us(){}var ss=Bi(It),ls=Bi(xt),cs=Bi(Dt);function fs(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var ps=Ui(),hs=Ui(!0);function bs(){return[]}function ds(){return!1}var vs,ys=zi((function(e,t){return e+t}),0),gs=Hi("ceil"),_s=zi((function(e,t){return e/t}),1),ms=Hi("floor"),ws=zi((function(e,t){return e*t}),1),Os=Hi("round"),js=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,s=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||su(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||si(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:li(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:li(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=sa,Ln.zip=la,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,as(Ln,Ln),Ln.add=ys,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gs,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_s,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ms,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=ns,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=su,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=lu,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,ns,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,ns)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,ns,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bs,Ln.stubFalse=ds,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=ws,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=us,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var s=n-cn(r);if(s<1)return r;var l=u?gi(u,0,s).join(""):e.slice(0,s);if(o===i)return l+r;if(u&&(s+=l.length-s),iu(o)){if(e.slice(s).search(o)){var c,f=l;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;l=l.slice(0,p===i?s:p)}}else if(e.indexOf(ai(o),s)!=s){var h=l.lastIndexOf(o);h>-1&&(l=l.slice(0,h))}return l+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,as(Ln,(vs={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vs[t]=e)})),vs),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(ns)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,s=t instanceof Un,l=u[0],c=s||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof l&&1!=l.length&&(s=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=s&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,s=a&&u&&"object"==typeof n.g&&n.g;!s||s.global!==s&&s.window!==s&&s.self!==s||(o=s);var l=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=l)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(l=n)?typeof l[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!l[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),s=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!s?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!s?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var s=t[o];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=n[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)lt(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,s=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var l=Vt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(s,l);e.then(c,n)}e=n,s(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function sn(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=l),an(this)){var o=sn(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return l;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=sn(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!sn(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=ln(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=ln(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=ln(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return lr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return lr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var s=r.value;if(!i.has(s))if(n.delete(s))a=!0;else{var l=n.data_.get(s);o.set(s,l)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!sn(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=ln(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!sn(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=ln(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return lr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=sr(e),t=sr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function sr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function lr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var s=a._childNodes[a.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw li(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var s,l,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(s=r.onError,l=n,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw li(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],si));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw li("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(r),s=!0)}s&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw li(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw li(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw li("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw li("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function lo(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new so(e,t,n||co)}var co=[void 0],fo=lo(eo,void 0),po=lo(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw li("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):lo(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Add 100000 objects to an array",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=No.model({name:No.string,id:No.string}),n=No.model({items:No.array(t)}).actions((e=>({add(t,n){e.items.push({name:t,id:n})}}))).create({items:[]});for(let e=0;e<1e5;e++)n.add(`item-${e}`,`id-${e}`);var r,i;r="Add 100000 objects to an array",i=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[r]?Ro[r]=Math.max(Ro[r],i):Ro[r]=i})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/add-100000-objects-to-an-array-web-bundle.js.LICENSE.txt b/build/add-100000-objects-to-an-array-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/add-100000-objects-to-an-array-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/add-a-patch-listener-to-a-model-bundle-source.js b/build/add-a-patch-listener-to-a-model-bundle-source.js new file mode 100644 index 0000000..35eb0e3 --- /dev/null +++ b/build/add-a-patch-listener-to-a-model-bundle-source.js @@ -0,0 +1,105 @@ + +import { types, onPatch } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Add a patch listener to a model", () => { + const startMemory = getStartMemory(); + const Model = types.model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, +}); + +const m = Model.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), +}); + +onPatch(m, (patch) => { + return patch; +}); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Add a patch listener to a model", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/add-a-patch-listener-to-a-model-node-bundle.js b/build/add-a-patch-listener-to-a-model-node-bundle.js new file mode 100644 index 0000000..8c68c55 --- /dev/null +++ b/build/add-a-patch-listener-to-a-model-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see add-a-patch-listener-to-a-model-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Vt(e){return v(e)&&!0===e.isMobxAction}function Ct(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Vr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Vr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Vr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Vr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Ct((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Vr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Vr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},C(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Vr=P("ObservableMap",Nr),Cr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Cr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Vr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Vr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Vi?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Vi&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Cn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Vn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Cn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Vn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Va=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Ca={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Ci(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Add a patch listener to a model",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,r,n,i;t=Ca.model({string:Ca.string,number:Ca.number,integer:Ca.integer,float:Ca.float,boolean:Ca.boolean,date:Ca.Date}).create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}),r=e=>e,Qn(),ei(t).onPatch(r),n="Add a patch listener to a model",i=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[n]?ka[n]=Math.max(ka[n],i):ka[n]=i})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/add-a-patch-listener-to-a-model-node-bundle.js.LICENSE.txt b/build/add-a-patch-listener-to-a-model-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/add-a-patch-listener-to-a-model-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/add-a-patch-listener-to-a-model-web-bundle.js b/build/add-a-patch-listener-to-a-model-web-bundle.js new file mode 100644 index 0000000..780b2aa --- /dev/null +++ b/build/add-a-patch-listener-to-a-model-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see add-a-patch-listener-to-a-model-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw si("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw si(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw si("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw si("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw si("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw si(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw si("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw si("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw si("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw si("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw si("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw si(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw si(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw si("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw si("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw si("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw si("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw si("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw si("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function so(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw si("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||co)}var co=[void 0],fo=so(eo,void 0),po=so(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw si("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw si("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw si("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw si("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw si("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw si("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):so(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Add a patch listener to a model",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,n,r,i;t=No.model({string:No.string,number:No.number,integer:No.integer,float:No.float,boolean:No.boolean,date:No.Date}).create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}),n=e=>e,Qr(),ei(t).onPatch(n),r="Add a patch listener to a model",i=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[r]?Ro[r]=Math.max(Ro[r],i):Ro[r]=i})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/add-a-patch-listener-to-a-model-web-bundle.js.LICENSE.txt b/build/add-a-patch-listener-to-a-model-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/add-a-patch-listener-to-a-model-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/add-middleware-and-use-it-bundle-source.js b/build/add-middleware-and-use-it-bundle-source.js new file mode 100644 index 0000000..b69dc71 --- /dev/null +++ b/build/add-middleware-and-use-it-bundle-source.js @@ -0,0 +1,105 @@ + +import { addMiddleware, types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Add middleware and use it", () => { + const startMemory = getStartMemory(); + const Todo = types.model({ + task: types.string, +}); + +const TodoStore = types + .model({ + todos: types.array(Todo), + }) + .actions((self) => ({ + add(todo) { + self.todos.push(todo); + }, + })); + +const s = TodoStore.create({ todos: [] }); + +addMiddleware(s, (call, next) => { + next(call); +}); + +s.add({ task: "string" }); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Add middleware and use it", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/add-middleware-and-use-it-node-bundle.js b/build/add-middleware-and-use-it-node-bundle.js new file mode 100644 index 0000000..580ec07 --- /dev/null +++ b/build/add-middleware-and-use-it-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see add-middleware-and-use-it-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Vt(e){return v(e)&&!0===e.isMobxAction}function Ct(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=kt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function kt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var Dt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Vr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Vr(e)||kr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Vr(e)?$t(e).map((function(t){return e.get(t)})):kr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||kr(e))Br(e)?e[F].set_(t,n):Vr(e)?e.set(t,n):kr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Ct((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Vr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Vr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},C(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Vr=P("ObservableMap",Nr),Cr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Cr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Vr(e)||S(e)||kr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=kt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return kn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Vr(n)?$t(n).map((function(e){return[e,n.get(e)]})):kr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Vi?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=kn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Vi&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Cn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Vn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function ki(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!ki(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var Di=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(ki(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Cn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return Dn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Vn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;kn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){Dn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Va=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Ca={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:kn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return Dn(),new Ci(e,t,r)}};const xa=require("benchmark");var ka=new(e.n(xa)().Suite);const Da={};ka.on("complete",(function(){const e=ka.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Da[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),ka.add("Add middleware and use it",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=Ca.model({task:Ca.string}),r=Ca.model({todos:Ca.array(t)}).actions((e=>({add(t){e.todos.push(t)}}))).create({todos:[]});var n,i,a,o;n=(e,t)=>{t(e)},void 0===i&&(i=!0),ei(r).addMiddleWare(n,i),r.add({task:"string"}),a="Add middleware and use it",o=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Da[a]?Da[a]=Math.max(Da[a],o):Da[a]=o})),ka.on("cycle",(function(e){console.log(String(e.target))})),ka.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/add-middleware-and-use-it-node-bundle.js.LICENSE.txt b/build/add-middleware-and-use-it-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/add-middleware-and-use-it-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/add-middleware-and-use-it-web-bundle.js b/build/add-middleware-and-use-it-web-bundle.js new file mode 100644 index 0000000..c7f2bf2 --- /dev/null +++ b/build/add-middleware-and-use-it-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see add-middleware-and-use-it-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,s=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),l=a.object&&e&&!e.nodeType&&e,c=s&&l&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(l&&l.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,l=e.Object,c=(e.RegExp,e.String),_=[],m=l.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,le(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=s&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,s={currentTarget:e},l={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),s.type="cycle",s.target=r,n=W(s),l.onCycle.call(e,n),n.aborted||!1===b())s.type="complete",l.onComplete.call(e,W(s));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function se(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function le(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,s=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+s+")"),fnArg:s,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}le=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,s=Z(u.fn),l=u.count=i.count,f=s||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||s);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=l)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=l}if(!v&&!a&&!y){v=o(u,f,a,d=(s||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=l,delete i.error}catch(e){u.count=l,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),le.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,s,l,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:le(t),l=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((s=W("error")).message=t.error,t.emit(s),s.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==l?1:-1:0):f<=(u<5||s<3?0:y[u][s-3])?f==l?1:-1:0},emit:oe,listeners:ae,off:ue,on:se,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,s=u.destination,l=s[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(l)||(r=!0,l=[]),l.length!=e.length&&(r=!0,(l=l.slice(0,e.length)).length=e.length)):t.isObjectLike(l)||(r=!0,l={}),r&&i.push({destination:s,key:n,value:l}),a.push({destination:l,source:e})):t.eq(l,e)||e===o||i.push({destination:s,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,s=[],l=e.stats.sample;function c(){s.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(s,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=l.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=l.length=s.length=0)),_||(f=q(l),y=t.reduce(l,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),s.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",s=32,l=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",l],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",s],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,se=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,le=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,st=parseInt,lt="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=lt||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&<.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=so(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,lt=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=so(t,"DataView"),jn=so(t,"Map"),Pn=so(t,"Promise"),Sn=so(t,"Set"),An=so(t,"WeakMap"),xn=so(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,s=1&t,l=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!s)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,s);if(p==P||p==d||h&&!o){if(u=l||h?{}:ho(e),!s)return l?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,lo(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,s)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?l?to:eo:l?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function sr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function lr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,s=[],l=t.length;if(!u)return s;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,s=u,l=r(u),c=1/0,f=[];s--;){var p=e[s];s&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),l[s]=!n&&(t||a>=120&&p.length>=120)?new Gn(s&&p):i}p=e[0];var h=-1,b=l[0];e:for(;++h=u?s:s*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,s,1),Ke.call(e,s,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):si(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,ns),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,s=e;null!=s&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var l=t?null:Gi(e);if(l)return sn(l);a=!1,i=Zt,s=new Gn}else s=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,s=null===t,l=t==t,c=uu(t);if(!s&&!c&&!a&&e>t||a&&u&&l&&!s&&!c||r&&u&&l||!n&&l||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!s&&"wrapper"==ro(u))var s=new Fn([],!0)}for(r=s?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof l&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?ts))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=lt||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,l,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=s}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=s}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,s,l,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,s=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);l=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return l=i,b&&r?d(e):(r=a=i,s)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(l===i)return function(e){return f=e,l=Eo(y,t),p?d(e):s}(c);if(h)return _i(l),l=Eo(y,t),d(c)}return l===i&&(l=Eo(y,t)),s}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){l!==i&&_i(l),f=0,r=c=a=l=i},_.flush=function(){return l===i?s:g(Sa())},_}var Ia=Kr((function(e,t){return sr(e,1,t)})),ka=Kr((function(e,t,n){return sr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||ds,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var su=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},lu=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?sn:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?st(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)si(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(se)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var es=Ri(),ts=Ri(!0);function ns(e){return e}function rs(e){return Nr("function"==typeof e?e:ar(e,1))}var is=Kr((function(e,t){return function(n){return Er(n,e,t)}})),os=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function as(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function us(){}var ss=Bi(It),ls=Bi(xt),cs=Bi(Dt);function fs(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var ps=Ui(),hs=Ui(!0);function bs(){return[]}function ds(){return!1}var vs,ys=zi((function(e,t){return e+t}),0),gs=Hi("ceil"),_s=zi((function(e,t){return e/t}),1),ms=Hi("floor"),ws=zi((function(e,t){return e*t}),1),Os=Hi("round"),js=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,s=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||su(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||si(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:li(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:li(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=sa,Ln.zip=la,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,as(Ln,Ln),Ln.add=ys,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gs,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_s,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ms,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=ns,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=su,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=lu,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,ns,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,ns)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,ns,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bs,Ln.stubFalse=ds,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=ws,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=us,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var s=n-cn(r);if(s<1)return r;var l=u?gi(u,0,s).join(""):e.slice(0,s);if(o===i)return l+r;if(u&&(s+=l.length-s),iu(o)){if(e.slice(s).search(o)){var c,f=l;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;l=l.slice(0,p===i?s:p)}}else if(e.indexOf(ai(o),s)!=s){var h=l.lastIndexOf(o);h>-1&&(l=l.slice(0,h))}return l+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,as(Ln,(vs={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vs[t]=e)})),vs),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(ns)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,s=t instanceof Un,l=u[0],c=s||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof l&&1!=l.length&&(s=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=s&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,s=a&&u&&"object"==typeof n.g&&n.g;!s||s.global!==s&&s.window!==s&&s.self!==s||(o=s);var l=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=l)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(l=n)?typeof l[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!l[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),s=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!s?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!s?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var s=t[o];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=n[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)lt(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,s=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var l=Vt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(s,l);e.then(c,n)}e=n,s(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function sn(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=l),an(this)){var o=sn(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return l;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=sn(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!sn(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=ln(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=ln(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=ln(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return lr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return lr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var s=r.value;if(!i.has(s))if(n.delete(s))a=!0;else{var l=n.data_.get(s);o.set(s,l)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!sn(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=ln(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!sn(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=ln(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return lr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=sr(e),t=sr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function sr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function lr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var s=a._childNodes[a.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw li(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var s,l,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(s=r.onError,l=n,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw li(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],si));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw li("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(r),s=!0)}s&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw li(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw li(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw li("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw li("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function lo(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new so(e,t,n||co)}var co=[void 0],fo=lo(eo,void 0),po=lo(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw li("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):lo(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Add middleware and use it",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=No.model({task:No.string}),n=No.model({todos:No.array(t)}).actions((e=>({add(t){e.todos.push(t)}}))).create({todos:[]});var r,i,o,a;r=(e,t)=>{t(e)},void 0===i&&(i=!0),ei(n).addMiddleWare(r,i),n.add({task:"string"}),o="Add middleware and use it",a=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[o]?Ro[o]=Math.max(Ro[o],a):Ro[o]=a})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/add-middleware-and-use-it-web-bundle.js.LICENSE.txt b/build/add-middleware-and-use-it-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/add-middleware-and-use-it-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/add-middleware-to-an-action-and-include-hooks-default-bundle-source.js b/build/add-middleware-to-an-action-and-include-hooks-default-bundle-source.js new file mode 100644 index 0000000..b4b275b --- /dev/null +++ b/build/add-middleware-to-an-action-and-include-hooks-default-bundle-source.js @@ -0,0 +1,101 @@ + +import { addMiddleware, types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Add middleware to an action and include hooks (default)", () => { + const startMemory = getStartMemory(); + const Todo = types.model({ + task: types.string, +}); + +const TodoStore = types + .model({ + todos: types.array(Todo), + }) + .actions((self) => ({ + add(todo) { + self.todos.push(todo); + }, + })); + +const s = TodoStore.create({ todos: [] }); + +addMiddleware(s, () => {}); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Add middleware to an action and include hooks (default)", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/add-middleware-to-an-action-and-include-hooks-default-node-bundle.js b/build/add-middleware-to-an-action-and-include-hooks-default-node-bundle.js new file mode 100644 index 0000000..6280209 --- /dev/null +++ b/build/add-middleware-to-an-action-and-include-hooks-default-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see add-middleware-to-an-action-and-include-hooks-default-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Vt(e){return v(e)&&!0===e.isMobxAction}function Ct(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=kt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function kt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var Dt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Vr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Vr(e)||kr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Vr(e)?$t(e).map((function(t){return e.get(t)})):kr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||kr(e))Br(e)?e[F].set_(t,n):Vr(e)?e.set(t,n):kr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Ct((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Vr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Vr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},C(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Vr=P("ObservableMap",Nr),Cr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Cr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Vr(e)||S(e)||kr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=kt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return kn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Vr(n)?$t(n).map((function(e){return[e,n.get(e)]})):kr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Vi?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=kn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Vi&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Cn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Vn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function ki(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!ki(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var Di=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(ki(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Cn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return Dn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Vn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;kn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){Dn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Va=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Ca={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:kn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return Dn(),new Ci(e,t,r)}};const xa=require("benchmark");var ka=new(e.n(xa)().Suite);const Da={};ka.on("complete",(function(){const e=ka.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Da[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),ka.add("Add middleware to an action and include hooks (default)",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=Ca.model({task:Ca.string});var r,n,i,a,o;r=Ca.model({todos:Ca.array(t)}).actions((e=>({add(t){e.todos.push(t)}}))).create({todos:[]}),n=()=>{},void 0===i&&(i=!0),ei(r).addMiddleWare(n,i),a="Add middleware to an action and include hooks (default)",o=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Da[a]?Da[a]=Math.max(Da[a],o):Da[a]=o})),ka.on("cycle",(function(e){console.log(String(e.target))})),ka.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/add-middleware-to-an-action-and-include-hooks-default-node-bundle.js.LICENSE.txt b/build/add-middleware-to-an-action-and-include-hooks-default-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/add-middleware-to-an-action-and-include-hooks-default-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/add-middleware-to-an-action-and-include-hooks-default-web-bundle.js b/build/add-middleware-to-an-action-and-include-hooks-default-web-bundle.js new file mode 100644 index 0000000..48e65de --- /dev/null +++ b/build/add-middleware-to-an-action-and-include-hooks-default-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see add-middleware-to-an-action-and-include-hooks-default-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw si("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw si(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw si("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw si("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw si("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw si(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw si("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw si("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw si("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw si("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw si("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw si(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw si(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw si("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw si("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw si("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw si("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw si("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw si("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function so(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw si("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||co)}var co=[void 0],fo=so(eo,void 0),po=so(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw si("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw si("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw si("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw si("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw si("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw si("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):so(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Add middleware to an action and include hooks (default)",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=No.model({task:No.string});var n,r,i,o,a;n=No.model({todos:No.array(t)}).actions((e=>({add(t){e.todos.push(t)}}))).create({todos:[]}),r=()=>{},void 0===i&&(i=!0),ei(n).addMiddleWare(r,i),o="Add middleware to an action and include hooks (default)",a=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[o]?Ro[o]=Math.max(Ro[o],a):Ro[o]=a})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/add-middleware-to-an-action-and-include-hooks-default-web-bundle.js.LICENSE.txt b/build/add-middleware-to-an-action-and-include-hooks-default-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/add-middleware-to-an-action-and-include-hooks-default-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/add-middleware-to-an-action-without-hooks-bundle-source.js b/build/add-middleware-to-an-action-without-hooks-bundle-source.js new file mode 100644 index 0000000..39f2e6b --- /dev/null +++ b/build/add-middleware-to-an-action-without-hooks-bundle-source.js @@ -0,0 +1,101 @@ + +import { addMiddleware, types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Add middleware to an action without hooks", () => { + const startMemory = getStartMemory(); + const Todo = types.model({ + task: types.string, +}); + +const TodoStore = types + .model({ + todos: types.array(Todo), + }) + .actions((self) => ({ + add(todo) { + self.todos.push(todo); + }, + })); + +const s = TodoStore.create({ todos: [] }); + +addMiddleware(s, () => {}, false); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Add middleware to an action without hooks", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/add-middleware-to-an-action-without-hooks-node-bundle.js b/build/add-middleware-to-an-action-without-hooks-node-bundle.js new file mode 100644 index 0000000..93b8020 --- /dev/null +++ b/build/add-middleware-to-an-action-without-hooks-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see add-middleware-to-an-action-without-hooks-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Vt(e){return v(e)&&!0===e.isMobxAction}function Ct(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=kt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function kt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var Dt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Vr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Vr(e)||kr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Vr(e)?$t(e).map((function(t){return e.get(t)})):kr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||kr(e))Br(e)?e[F].set_(t,n):Vr(e)?e.set(t,n):kr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Ct((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Vr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Vr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},C(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Vr=P("ObservableMap",Nr),Cr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Cr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Vr(e)||S(e)||kr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=kt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return kn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Vr(n)?$t(n).map((function(e){return[e,n.get(e)]})):kr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Vi?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=kn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Vi&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Cn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Vn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function ki(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!ki(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var Di=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(ki(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Cn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return Dn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Vn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;kn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){Dn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Va=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Ca={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:kn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return Dn(),new Ci(e,t,r)}};const xa=require("benchmark");var ka=new(e.n(xa)().Suite);const Da={};ka.on("complete",(function(){const e=ka.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Da[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),ka.add("Add middleware to an action without hooks",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=Ca.model({task:Ca.string});var r,n,i,a,o;r=Ca.model({todos:Ca.array(t)}).actions((e=>({add(t){e.todos.push(t)}}))).create({todos:[]}),n=()=>{},void 0===(i=!1)&&(i=!0),ei(r).addMiddleWare(n,i),a="Add middleware to an action without hooks",o=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Da[a]?Da[a]=Math.max(Da[a],o):Da[a]=o})),ka.on("cycle",(function(e){console.log(String(e.target))})),ka.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/add-middleware-to-an-action-without-hooks-node-bundle.js.LICENSE.txt b/build/add-middleware-to-an-action-without-hooks-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/add-middleware-to-an-action-without-hooks-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/add-middleware-to-an-action-without-hooks-web-bundle.js b/build/add-middleware-to-an-action-without-hooks-web-bundle.js new file mode 100644 index 0000000..4a0f382 --- /dev/null +++ b/build/add-middleware-to-an-action-without-hooks-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see add-middleware-to-an-action-without-hooks-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,s=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),l=a.object&&e&&!e.nodeType&&e,c=s&&l&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(l&&l.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,l=e.Object,c=(e.RegExp,e.String),_=[],m=l.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,le(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=s&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,s={currentTarget:e},l={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),s.type="cycle",s.target=r,n=W(s),l.onCycle.call(e,n),n.aborted||!1===b())s.type="complete",l.onComplete.call(e,W(s));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function se(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function le(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,s=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+s+")"),fnArg:s,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}le=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,s=Z(u.fn),l=u.count=i.count,f=s||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||s);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=l)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=l}if(!v&&!a&&!y){v=o(u,f,a,d=(s||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=l,delete i.error}catch(e){u.count=l,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),le.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,s,l,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:le(t),l=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((s=W("error")).message=t.error,t.emit(s),s.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==l?1:-1:0):f<=(u<5||s<3?0:y[u][s-3])?f==l?1:-1:0},emit:oe,listeners:ae,off:ue,on:se,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,s=u.destination,l=s[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(l)||(r=!0,l=[]),l.length!=e.length&&(r=!0,(l=l.slice(0,e.length)).length=e.length)):t.isObjectLike(l)||(r=!0,l={}),r&&i.push({destination:s,key:n,value:l}),a.push({destination:l,source:e})):t.eq(l,e)||e===o||i.push({destination:s,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,s=[],l=e.stats.sample;function c(){s.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(s,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=l.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=l.length=s.length=0)),_||(f=q(l),y=t.reduce(l,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),s.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",s=32,l=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",l],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",s],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,se=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,le=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,st=parseInt,lt="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=lt||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&<.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=so(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,lt=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=so(t,"DataView"),jn=so(t,"Map"),Pn=so(t,"Promise"),Sn=so(t,"Set"),An=so(t,"WeakMap"),xn=so(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,s=1&t,l=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!s)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,s);if(p==P||p==d||h&&!o){if(u=l||h?{}:ho(e),!s)return l?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,lo(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,s)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?l?to:eo:l?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function sr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function lr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,s=[],l=t.length;if(!u)return s;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,s=u,l=r(u),c=1/0,f=[];s--;){var p=e[s];s&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),l[s]=!n&&(t||a>=120&&p.length>=120)?new Gn(s&&p):i}p=e[0];var h=-1,b=l[0];e:for(;++h=u?s:s*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,s,1),Ke.call(e,s,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):si(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,ns),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,s=e;null!=s&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var l=t?null:Gi(e);if(l)return sn(l);a=!1,i=Zt,s=new Gn}else s=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,s=null===t,l=t==t,c=uu(t);if(!s&&!c&&!a&&e>t||a&&u&&l&&!s&&!c||r&&u&&l||!n&&l||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!s&&"wrapper"==ro(u))var s=new Fn([],!0)}for(r=s?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof l&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?ts))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=lt||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,l,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=s}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=s}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,s,l,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,s=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);l=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return l=i,b&&r?d(e):(r=a=i,s)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(l===i)return function(e){return f=e,l=Eo(y,t),p?d(e):s}(c);if(h)return _i(l),l=Eo(y,t),d(c)}return l===i&&(l=Eo(y,t)),s}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){l!==i&&_i(l),f=0,r=c=a=l=i},_.flush=function(){return l===i?s:g(Sa())},_}var Ia=Kr((function(e,t){return sr(e,1,t)})),ka=Kr((function(e,t,n){return sr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||ds,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var su=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},lu=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?sn:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?st(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)si(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(se)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var es=Ri(),ts=Ri(!0);function ns(e){return e}function rs(e){return Nr("function"==typeof e?e:ar(e,1))}var is=Kr((function(e,t){return function(n){return Er(n,e,t)}})),os=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function as(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function us(){}var ss=Bi(It),ls=Bi(xt),cs=Bi(Dt);function fs(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var ps=Ui(),hs=Ui(!0);function bs(){return[]}function ds(){return!1}var vs,ys=zi((function(e,t){return e+t}),0),gs=Hi("ceil"),_s=zi((function(e,t){return e/t}),1),ms=Hi("floor"),ws=zi((function(e,t){return e*t}),1),Os=Hi("round"),js=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,s=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||su(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||si(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:li(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:li(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=sa,Ln.zip=la,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,as(Ln,Ln),Ln.add=ys,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gs,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_s,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ms,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=ns,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=su,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=lu,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,ns,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,ns)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,ns,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bs,Ln.stubFalse=ds,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=ws,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=us,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var s=n-cn(r);if(s<1)return r;var l=u?gi(u,0,s).join(""):e.slice(0,s);if(o===i)return l+r;if(u&&(s+=l.length-s),iu(o)){if(e.slice(s).search(o)){var c,f=l;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;l=l.slice(0,p===i?s:p)}}else if(e.indexOf(ai(o),s)!=s){var h=l.lastIndexOf(o);h>-1&&(l=l.slice(0,h))}return l+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,as(Ln,(vs={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vs[t]=e)})),vs),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(ns)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,s=t instanceof Un,l=u[0],c=s||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof l&&1!=l.length&&(s=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=s&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,s=a&&u&&"object"==typeof n.g&&n.g;!s||s.global!==s&&s.window!==s&&s.self!==s||(o=s);var l=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=l)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(l=n)?typeof l[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!l[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),s=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!s?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!s?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var s=t[o];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=n[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)lt(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,s=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var l=Vt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(s,l);e.then(c,n)}e=n,s(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function sn(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=l),an(this)){var o=sn(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return l;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=sn(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!sn(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=ln(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=ln(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=ln(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return lr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return lr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var s=r.value;if(!i.has(s))if(n.delete(s))a=!0;else{var l=n.data_.get(s);o.set(s,l)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!sn(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=ln(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!sn(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=ln(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return lr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=sr(e),t=sr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function sr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function lr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var s=a._childNodes[a.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw li(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var s,l,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(s=r.onError,l=n,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw li(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],si));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw li("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(r),s=!0)}s&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw li(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw li(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw li("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw li("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function lo(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new so(e,t,n||co)}var co=[void 0],fo=lo(eo,void 0),po=lo(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw li("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):lo(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Add middleware to an action without hooks",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=No.model({task:No.string});var n,r,i,o,a;n=No.model({todos:No.array(t)}).actions((e=>({add(t){e.todos.push(t)}}))).create({todos:[]}),r=()=>{},void 0===(i=!1)&&(i=!0),ei(n).addMiddleWare(r,i),o="Add middleware to an action without hooks",a=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[o]?Ro[o]=Math.max(Ro[o],a):Ro[o]=a})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/add-middleware-to-an-action-without-hooks-web-bundle.js.LICENSE.txt b/build/add-middleware-to-an-action-without-hooks-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/add-middleware-to-an-action-without-hooks-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/add-onaction-to-a-model-bundle-source.js b/build/add-onaction-to-a-model-bundle-source.js new file mode 100644 index 0000000..611c1a3 --- /dev/null +++ b/build/add-onaction-to-a-model-bundle-source.js @@ -0,0 +1,105 @@ + +import { types, onAction } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Add onAction to a model", () => { + const startMemory = getStartMemory(); + const Todo = types.model({ + task: types.string, +}); + +const TodoStore = types + .model({ + todos: types.array(Todo), + }) + .actions((self) => ({ + add(todo) { + self.todos.push(todo); + }, + })); + +const s = TodoStore.create({ todos: [] }); + +let disposer = onAction(s, (call) => { + console.log(call); +}); + +return disposer; + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Add onAction to a model", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/add-onaction-to-a-model-node-bundle.js b/build/add-onaction-to-a-model-node-bundle.js new file mode 100644 index 0000000..7b62ba9 --- /dev/null +++ b/build/add-onaction-to-a-model-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see add-onaction-to-a-model-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Yn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new Jn),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw pi("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=xa(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Yn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ci,this.state=Yn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=Yn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw pi(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ni(e.subpath)||"",n=e.actionContext||Ln;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(ei(i=n.context,1),ti(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ci),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ui(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw pi("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw pi("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=zn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=xi(t.path);oi(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=zn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),wi(this.storedValue,"$treenode",this),wi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Yn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new Pi),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Ln,Mn=1;function zn(e,t,r){var n=function(){var n=Mn++,i=Ln,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ti(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Ln;Ln=e;try{return function(e,t,r){var n=new Un(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Ln=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:ji(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var Un=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Bn(e){return"function"==typeof e?"":Qn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Qn(t)?"value of type "+ti(t).type.name+":":mi(t)?"value":"snapshot",o=r&&Qn(t)&&r.is(ti(t).snapshot);return""+i+a+" "+Bn(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||mi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Hn(e,t,r){return e.concat([{path:t,type:r}])}function Gn(){return li}function Kn(e,t,r){return[{context:e,value:t,message:r}]}function Wn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function qn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw pi(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Bn(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Fn).join("\n ")}(e,t,r))}(e,t)}var Yn,$n=0,Jn=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:$n++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],fi));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw pi("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw pi("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Xn(e,t,r,n,i){var a=ri(i);if(a){if(a.parent)throw pi("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Zn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Qn(e){return!(!e||!e.$treenode)}function ei(e,t){Ai()}function ti(e){if(!Qn(e))throw pi("Value "+e+" is no MST Node");return e.$treenode}function ri(e){return e&&e.$treenode||null}function ni(){return ti(this).snapshot}!function(e){e[e.INITIALIZING=0]="INITIALIZING",e[e.CREATED=1]="CREATED",e[e.FINALIZED=2]="FINALIZED",e[e.DETACHING=3]="DETACHING",e[e.DEAD=4]="DEAD"}(Yn||(Yn={}));var ii=function(e){return".."};function ai(e,t){if(e.root!==t.root)throw pi("Cannot calculate relative path: objects '"+e+"' and '"+t+"' are not part of the same object tree");for(var r=xi(e.path),n=xi(t.path),i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Qn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Qn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===ki?Kn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Qn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==ki&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),Li="Map.put can only be used to store complex values that have an identifier type attribute";function Mi(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=vi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Mi(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof $i&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Di||(Di={}));var zi=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw pi("Map.put cannot be used to set empty values");if(Qn(e)){var t=ti(e);if(null===t.identifier)throw pi(Li);return this.set(t.identifier,e),e}if(gi(e)){var r=ti(this),n=r.type;if(n.identifierMode!==Di.YES)throw pi(Li);var i=e[n.mapIdentifierAttribute];if(!Da(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=xa(i);return this.set(o,e),this.get(o)}throw pi("Map.put can only be used to store complex values")}}),t}(Nr),Ui=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Di.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Di.UNKNOWN){var e=[];if(Mi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw pi("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Di.YES,this.mapIdentifierAttribute=t):this.identifierMode=Di.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new zi(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=zn(t,e,n);wi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw pi("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ti(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;qn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":qn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Di.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw pi("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ti(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ni(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ni(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ni(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){qn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return yi(e)?Wn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Hn(t,n,r._subType))}))):Kn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ci}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ui.prototype.applySnapshot=Tt(Ui.prototype.applySnapshot);var Bi=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},fi),{name:this.name});return Ae.array(ui(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=zn(t,e,n);wi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Qn(e)?ti(e).snapshot:e;return this._predicate(n)?Gn():Kn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),ca=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw pi("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw pi("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&qn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Gn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function ba(e,t,r){return function(e,t){if("function"!=typeof t&&Qn(t))throw pi("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new pa(e,t,r||ha)}var ha=[void 0],da=ba(ia,void 0),va=ba(na,null);function ya(e){return kn(),fa(e,da)}var ga=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw pi("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Gn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),ma=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Zn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):_i(e)?Gn():Kn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),_a=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Zn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return _i(e)?this.subType?this.subType.validate(e,t):Gn():Kn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),wa=new _a,Oa=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Da(e))this.identifier=e;else{if(!Qn(e))throw pi("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ti(e);if(!r.identifierAttribute)throw pi("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw pi("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=xa(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new Pa("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),Pa=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),ja=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Da(e)?Gn():Kn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ti(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,xa(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Yn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),Sa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Qn(n)?(ei(i=n),ti(i).identifier):n,o=new Oa(n,this.targetType),u=Zn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Qn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(ja),Aa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Qn(n)?this.options.set(n,e?e.storedValue:null):n,a=Zn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Qn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(ja);function Ea(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Aa(e,{get:r.get,set:r.set},n):new Sa(e,n)}var Ta=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof $i))throw pi("Identifier types can only be instantiated as direct child of a model type");return Zn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw pi("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Kn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Gn()}}),t}(xn),Ia=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(Ta),Na=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(Ta),Ca=new Ia,Va=new Na;function xa(e){return""+e}function Da(e){return"string"==typeof e||"number"==typeof e}var ka=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Gn();var r=this.options.getValidationMessage(e);return r?Kn(t,e,"Invalid value for type '"+this.name+"': "+r):Gn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Zn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Ra={enumeration:function(e,t){var r="string"==typeof e?t:e,n=fa.apply(void 0,yn(r.map((function(e){return sa(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Bi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?wa:Dn(e)?new _a(e):ba(wa,e)},identifier:Ca,identifierNumber:Va,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ga(r,"string"==typeof e?t:e)},lazy:function(e,t){return new ma(e,t)},undefined:ia,null:na,snapshotProcessor:function(e,t,r){return kn(),new Ri(e,t,r)}};const La=require("benchmark");var Ma=new(e.n(La)().Suite);const za={};Ma.on("complete",(function(){const e=Ma.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:za[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Ma.add("Add onAction to a model",(()=>{void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;const e=Ra.model({task:Ra.string});return t=Ra.model({todos:Ra.array(e)}).actions((e=>({add(t){e.todos.push(t)}}))).create({todos:[]}),r=e=>{console.log(e)},void 0===n&&(n=!1),ei(),function(e,t,r){return void 0===r&&(r=!0),ti(e).addMiddleWare(t,r)}(t,(function(e,i){if("action"===e.type&&e.id===e.rootId){var a=ti(e.context),o={name:e.name,path:ai(ti(t),a),args:e.args.map((function(t,r){return function(e,t,r,n){if(n instanceof Date)return{$MST_DATE:n.getTime()};if(mi(n))return n;if(Qn(n))return Rn("[MSTNode: "+gn(n).name+"]");if("function"==typeof n)return Rn("[function]");if("object"==typeof n&&!yi(n)&&!di(n))return Rn("[object "+(n&&n.constructor&&n.constructor.name||"Complex Object")+"]");try{return JSON.stringify(n),n}catch(e){return Rn(""+e)}}(0,e.name,0,t)}))};if(n){var u=i(e);return r(o),u}return r(o),i(e)}return i(e)}));var t,r,n})),Ma.on("cycle",(function(e){console.log(String(e.target))})),Ma.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/add-onaction-to-a-model-node-bundle.js.LICENSE.txt b/build/add-onaction-to-a-model-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/add-onaction-to-a-model-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/add-onaction-to-a-model-web-bundle.js b/build/add-onaction-to-a-model-web-bundle.js new file mode 100644 index 0000000..0f97faa --- /dev/null +++ b/build/add-onaction-to-a-model-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see add-onaction-to-a-model-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Z(e,"document")&&e.document,V=k("microtime"),D=Z(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Z(e,"navigator")&&!Z(e,"phantom"),z.timeout=Z(e,"setTimeout")&&Z(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Y(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Z(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Y(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Y(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Z=/<%([\s\S]+?)%>/g,Y=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ze=RegExp("['’]","g"),Ye=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Yt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Za(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Zr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Yt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Za(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Za(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Ya(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Yi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Zt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ye,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Zu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Yu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Za(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Za(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Zt(e,Iu(e))},Ln.without=oa,Ln.words=Zu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Zr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Yu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ze(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ye(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Z(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Zt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Yt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Yt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Zr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw pi("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Vo(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ci,this.state=qr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=qr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw pi(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&Ci(e.subpath)||"",r=e.actionContext||Mr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(ei(i=r.context,1),ti(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ci),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ui(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw pi("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw pi("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=zr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=Ni(t.path);ai(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=zr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),wi(this.storedValue,"$treenode",this),wi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new ji),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Mr,Lr=1;function zr(e,t,n){var r=function(){var r=Lr++,i=Mr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ti(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Mr;Mr=e;try{return function(e,t,n){var r=new Br(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Mr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:Pi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var Br=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Fr(e){return"function"==typeof e?"":Qr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Ur(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Qr(t)?"value of type "+ti(t).type.name+":":_i(t)?"value":"snapshot",a=n&&Qr(t)&&n.is(ti(t).snapshot);return""+i+o+" "+Fr(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||_i(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Wr(e,t,n){return e.concat([{path:t,type:n}])}function $r(){return si}function Hr(e,t,n){return[{context:e,value:t,message:n}]}function Gr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Kr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw pi(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Fr(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Ur).join("\n ")}(e,t,n))}(e,t)}var qr,Xr=0,Zr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Xr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],fi));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw pi("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Zt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw pi("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ni(i);if(o){if(o.parent)throw pi("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Jr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Qr(e){return!(!e||!e.$treenode)}function ei(e,t){Ai()}function ti(e){if(!Qr(e))throw pi("Value "+e+" is no MST Node");return e.$treenode}function ni(e){return e&&e.$treenode||null}function ri(){return ti(this).snapshot}!function(e){e[e.INITIALIZING=0]="INITIALIZING",e[e.CREATED=1]="CREATED",e[e.FINALIZED=2]="FINALIZED",e[e.DETACHING=3]="DETACHING",e[e.DEAD=4]="DEAD"}(qr||(qr={}));var ii=function(e){return".."};function oi(e,t){if(e.root!==t.root)throw pi("Cannot calculate relative path: objects '"+e+"' and '"+t+"' are not part of the same object tree");for(var n=Ni(e.path),r=Ni(t.path),i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Qr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Qr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Di?Hr(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Qr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Di&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Mi="Map.put can only be used to store complex values that have an identifier type attribute";function Li(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=vi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Li(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Xi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Vi||(Vi={}));var zi=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw pi("Map.put cannot be used to set empty values");if(Qr(e)){var t=ti(e);if(null===t.identifier)throw pi(Mi);return this.set(t.identifier,e),e}if(gi(e)){var n=ti(this),r=n.type;if(r.identifierMode!==Vi.YES)throw pi(Mi);var i=e[r.mapIdentifierAttribute];if(!Do(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Vo(i);return this.set(a,e),this.get(a)}throw pi("Map.put can only be used to store complex values")}}),t}(In),Bi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Vi.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Vi.UNKNOWN){var e=[];if(Li(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw pi("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Vi.YES,this.mapIdentifierAttribute=t):this.identifierMode=Vi.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new zi(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=zr(t,e,r);wi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Zt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw pi("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ti(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Kr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Kr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Vi.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw pi("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ti(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ci(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ci(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ci(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Kr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return yi(e)?Gr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Wr(t,r,n._subType))}))):Hr(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ci}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Bi.prototype.applySnapshot=Et(Bi.prototype.applySnapshot);var Fi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},fi),{name:this.name});return Ae.array(ui(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=zr(t,e,r);wi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Qr(e)?ti(e).snapshot:e;return this._predicate(r)?$r():Hr(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),co=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw pi("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw pi("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Kr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?$r():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function ho(e,t,n){return function(e,t){if("function"!=typeof t&&Qr(t))throw pi("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new po(e,t,n||bo)}var bo=[void 0],vo=ho(io,void 0),yo=ho(ro,null);function go(e){return Dr(),fo(e,vo)}var _o=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw pi("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):$r()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),mo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Jr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):mi(e)?$r():Hr(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),wo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Jr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return mi(e)?this.subType?this.subType.validate(e,t):$r():Hr(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),Oo=new wo,jo=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Do(e))this.identifier=e;else{if(!Qr(e))throw pi("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ti(e);if(!n.identifierAttribute)throw pi("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw pi("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vo(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new Po("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),Po=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),So=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Do(e)?$r():Hr(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ti(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Vo(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Ao=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Qr(r)?(ei(i=r),ti(i).identifier):r,a=new jo(r,this.targetType),u=Jr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Qr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(So),xo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Qr(r)?this.options.set(r,e?e.storedValue:null):r,o=Jr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Qr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(So);function Eo(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new xo(e,{get:n.get,set:n.set},r):new Ao(e,r)}var To=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Xi))throw pi("Identifier types can only be instantiated as direct child of a model type");return Jr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw pi("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Hr(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):$r()}}),t}(Nr),Co=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(To),Io=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(To),ko=new Co,No=new Io;function Vo(e){return""+e}function Do(e){return"string"==typeof e||"number"==typeof e}var Ro=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return $r();var n=this.options.getValidationMessage(e);return n?Hr(t,e,"Invalid value for type '"+this.name+"': "+n):$r()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Jr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),Mo={enumeration:function(e,t){var n="string"==typeof e?t:e,r=fo.apply(void 0,yr(n.map((function(e){return lo(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Fi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?Oo:Vr(e)?new wo(e):ho(Oo,e)},identifier:ko,identifierNumber:No,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new _o(n,"string"==typeof e?t:e)},lazy:function(e,t){return new mo(e,t)},undefined:io,null:ro,snapshotProcessor:function(e,t,n){return Dr(),new Ri(e,t,n)}},Lo=n(215),zo=new(n.n(Lo)().Suite);const Bo={};zo.on("complete",(function(){const e=zo.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Bo[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),zo.add("Add onAction to a model",(()=>{void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;const e=Mo.model({task:Mo.string});return t=Mo.model({todos:Mo.array(e)}).actions((e=>({add(t){e.todos.push(t)}}))).create({todos:[]}),n=e=>{console.log(e)},void 0===r&&(r=!1),ei(),function(e,t,n){return void 0===n&&(n=!0),ti(e).addMiddleWare(t,n)}(t,(function(e,i){if("action"===e.type&&e.id===e.rootId){var o=ti(e.context),a={name:e.name,path:oi(ti(t),o),args:e.args.map((function(t,n){return function(e,t,n,r){if(r instanceof Date)return{$MST_DATE:r.getTime()};if(_i(r))return r;if(Qr(r))return Rr("[MSTNode: "+gr(r).name+"]");if("function"==typeof r)return Rr("[function]");if("object"==typeof r&&!yi(r)&&!di(r))return Rr("[object "+(r&&r.constructor&&r.constructor.name||"Complex Object")+"]");try{return JSON.stringify(r),r}catch(e){return Rr(""+e)}}(0,e.name,0,t)}))};if(r){var u=i(e);return n(a),u}return n(a),i(e)}return i(e)}));var t,n,r})),zo.on("cycle",(function(e){console.log(String(e.target))})),zo.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/add-onaction-to-a-model-web-bundle.js.LICENSE.txt b/build/add-onaction-to-a-model-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/add-onaction-to-a-model-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/apply-a-snapshot-to-a-model-bundle-source.js b/build/apply-a-snapshot-to-a-model-bundle-source.js new file mode 100644 index 0000000..22c8fcf --- /dev/null +++ b/build/apply-a-snapshot-to-a-model-bundle-source.js @@ -0,0 +1,104 @@ + +import { types, getSnapshot, applySnapshot } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Apply a snapshot to a model", () => { + const startMemory = getStartMemory(); + const Model = types.model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, +}); + +const m = Model.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), +}); + +const snapshot = getSnapshot(m); +applySnapshot(m, snapshot); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Apply a snapshot to a model", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/apply-a-snapshot-to-a-model-node-bundle.js b/build/apply-a-snapshot-to-a-model-node-bundle.js new file mode 100644 index 0000000..fa505a2 --- /dev/null +++ b/build/apply-a-snapshot-to-a-model-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see apply-a-snapshot-to-a-model-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Vt(e){return v(e)&&!0===e.isMobxAction}function Ct(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Vr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Vr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Vr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Vr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Ct((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Vr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Vr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},C(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Vr=P("ObservableMap",Nr),Cr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Cr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Vr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Vr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Vi?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Vi&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Cn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Vn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Cn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Vn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Va=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Ca={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Ci(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Apply a snapshot to a model",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=Ca.model({string:Ca.string,number:Ca.number,integer:Ca.integer,float:Ca.float,boolean:Ca.boolean,date:Ca.Date}).create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date});var r,n,i,a;r=t,n=_n(t),Qn(),ei(r).applySnapshot(n),i="Apply a snapshot to a model",a=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[i]?ka[i]=Math.max(ka[i],a):ka[i]=a})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/apply-a-snapshot-to-a-model-node-bundle.js.LICENSE.txt b/build/apply-a-snapshot-to-a-model-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/apply-a-snapshot-to-a-model-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/apply-a-snapshot-to-a-model-web-bundle.js b/build/apply-a-snapshot-to-a-model-web-bundle.js new file mode 100644 index 0000000..71793b9 --- /dev/null +++ b/build/apply-a-snapshot-to-a-model-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see apply-a-snapshot-to-a-model-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw si("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw si(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw si("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw si("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw si("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw si(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw si("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw si("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw si("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw si("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw si("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw si(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw si(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw si("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw si("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw si("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw si("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw si("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw si("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function so(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw si("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||co)}var co=[void 0],fo=so(eo,void 0),po=so(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw si("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw si("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw si("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw si("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw si("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw si("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):so(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Apply a snapshot to a model",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=No.model({string:No.string,number:No.number,integer:No.integer,float:No.float,boolean:No.boolean,date:No.Date}).create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date});var n,r,i,o;n=t,r=mr(t),Qr(),ei(n).applySnapshot(r),i="Apply a snapshot to a model",o=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[i]?Ro[i]=Math.max(Ro[i],o):Ro[i]=o})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/apply-a-snapshot-to-a-model-web-bundle.js.LICENSE.txt b/build/apply-a-snapshot-to-a-model-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/apply-a-snapshot-to-a-model-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/apply-a-snapshot-to-a-model-with-a-snapshot-listener-bundle-source.js b/build/apply-a-snapshot-to-a-model-with-a-snapshot-listener-bundle-source.js new file mode 100644 index 0000000..e90cc30 --- /dev/null +++ b/build/apply-a-snapshot-to-a-model-with-a-snapshot-listener-bundle-source.js @@ -0,0 +1,108 @@ + +import { types, getSnapshot, applySnapshot, onSnapshot } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Apply a snapshot to a model with a snapshot listener", () => { + const startMemory = getStartMemory(); + const Model = types.model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, +}); + +const m = Model.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), +}); + +onSnapshot(m, (snapshot) => { + return snapshot; +}); + +const snapshot = getSnapshot(m); +applySnapshot(m, snapshot); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Apply a snapshot to a model with a snapshot listener", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/apply-a-snapshot-to-a-model-with-a-snapshot-listener-node-bundle.js b/build/apply-a-snapshot-to-a-model-with-a-snapshot-listener-node-bundle.js new file mode 100644 index 0000000..a526138 --- /dev/null +++ b/build/apply-a-snapshot-to-a-model-with-a-snapshot-listener-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see apply-a-snapshot-to-a-model-with-a-snapshot-listener-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Vt(e){return v(e)&&!0===e.isMobxAction}function Ct(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Vr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Vr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Vr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Vr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Ct((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Vr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Vr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},C(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Vr=P("ObservableMap",Nr),Cr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Cr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Vr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Vr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Vi?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Vi&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Cn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Vn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Cn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Vn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Va=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Ca={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Ci(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Apply a snapshot to a model with a snapshot listener",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=Ca.model({string:Ca.string,number:Ca.number,integer:Ca.integer,float:Ca.float,boolean:Ca.boolean,date:Ca.Date}).create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date});var r,n,i,a;n=e=>e,Qn(r=t),ei(r).onSnapshot(n),function(e,t){Qn(),ei(e).applySnapshot(t)}(t,_n(t)),i="Apply a snapshot to a model with a snapshot listener",a=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[i]?ka[i]=Math.max(ka[i],a):ka[i]=a})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/apply-a-snapshot-to-a-model-with-a-snapshot-listener-node-bundle.js.LICENSE.txt b/build/apply-a-snapshot-to-a-model-with-a-snapshot-listener-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/apply-a-snapshot-to-a-model-with-a-snapshot-listener-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/apply-a-snapshot-to-a-model-with-a-snapshot-listener-web-bundle.js b/build/apply-a-snapshot-to-a-model-with-a-snapshot-listener-web-bundle.js new file mode 100644 index 0000000..0d10525 --- /dev/null +++ b/build/apply-a-snapshot-to-a-model-with-a-snapshot-listener-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see apply-a-snapshot-to-a-model-with-a-snapshot-listener-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,s=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),l=a.object&&e&&!e.nodeType&&e,c=s&&l&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(l&&l.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,l=e.Object,c=(e.RegExp,e.String),_=[],m=l.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,le(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=s&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,s={currentTarget:e},l={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),s.type="cycle",s.target=r,n=W(s),l.onCycle.call(e,n),n.aborted||!1===b())s.type="complete",l.onComplete.call(e,W(s));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function se(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function le(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,s=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+s+")"),fnArg:s,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}le=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,s=Z(u.fn),l=u.count=i.count,f=s||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||s);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=l)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=l}if(!v&&!a&&!y){v=o(u,f,a,d=(s||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=l,delete i.error}catch(e){u.count=l,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),le.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,s,l,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:le(t),l=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((s=W("error")).message=t.error,t.emit(s),s.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==l?1:-1:0):f<=(u<5||s<3?0:y[u][s-3])?f==l?1:-1:0},emit:oe,listeners:ae,off:ue,on:se,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,s=u.destination,l=s[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(l)||(r=!0,l=[]),l.length!=e.length&&(r=!0,(l=l.slice(0,e.length)).length=e.length)):t.isObjectLike(l)||(r=!0,l={}),r&&i.push({destination:s,key:n,value:l}),a.push({destination:l,source:e})):t.eq(l,e)||e===o||i.push({destination:s,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,s=[],l=e.stats.sample;function c(){s.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(s,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=l.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=l.length=s.length=0)),_||(f=q(l),y=t.reduce(l,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),s.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",s=32,l=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",l],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",s],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,se=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,le=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,st=parseInt,lt="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=lt||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&<.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=so(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,lt=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=so(t,"DataView"),jn=so(t,"Map"),Pn=so(t,"Promise"),Sn=so(t,"Set"),An=so(t,"WeakMap"),xn=so(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,s=1&t,l=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!s)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,s);if(p==P||p==d||h&&!o){if(u=l||h?{}:ho(e),!s)return l?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,lo(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,s)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?l?to:eo:l?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function sr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function lr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,s=[],l=t.length;if(!u)return s;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,s=u,l=r(u),c=1/0,f=[];s--;){var p=e[s];s&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),l[s]=!n&&(t||a>=120&&p.length>=120)?new Gn(s&&p):i}p=e[0];var h=-1,b=l[0];e:for(;++h=u?s:s*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,s,1),Ke.call(e,s,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):si(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,ns),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,s=e;null!=s&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var l=t?null:Gi(e);if(l)return sn(l);a=!1,i=Zt,s=new Gn}else s=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,s=null===t,l=t==t,c=uu(t);if(!s&&!c&&!a&&e>t||a&&u&&l&&!s&&!c||r&&u&&l||!n&&l||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!s&&"wrapper"==ro(u))var s=new Fn([],!0)}for(r=s?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof l&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?ts))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=lt||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,l,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=s}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=s}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,s,l,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,s=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);l=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return l=i,b&&r?d(e):(r=a=i,s)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(l===i)return function(e){return f=e,l=Eo(y,t),p?d(e):s}(c);if(h)return _i(l),l=Eo(y,t),d(c)}return l===i&&(l=Eo(y,t)),s}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){l!==i&&_i(l),f=0,r=c=a=l=i},_.flush=function(){return l===i?s:g(Sa())},_}var Ia=Kr((function(e,t){return sr(e,1,t)})),ka=Kr((function(e,t,n){return sr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||ds,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var su=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},lu=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?sn:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?st(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)si(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(se)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var es=Ri(),ts=Ri(!0);function ns(e){return e}function rs(e){return Nr("function"==typeof e?e:ar(e,1))}var is=Kr((function(e,t){return function(n){return Er(n,e,t)}})),os=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function as(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function us(){}var ss=Bi(It),ls=Bi(xt),cs=Bi(Dt);function fs(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var ps=Ui(),hs=Ui(!0);function bs(){return[]}function ds(){return!1}var vs,ys=zi((function(e,t){return e+t}),0),gs=Hi("ceil"),_s=zi((function(e,t){return e/t}),1),ms=Hi("floor"),ws=zi((function(e,t){return e*t}),1),Os=Hi("round"),js=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,s=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||su(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||si(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:li(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:li(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=sa,Ln.zip=la,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,as(Ln,Ln),Ln.add=ys,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gs,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_s,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ms,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=ns,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=su,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=lu,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,ns,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,ns)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,ns,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bs,Ln.stubFalse=ds,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=ws,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=us,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var s=n-cn(r);if(s<1)return r;var l=u?gi(u,0,s).join(""):e.slice(0,s);if(o===i)return l+r;if(u&&(s+=l.length-s),iu(o)){if(e.slice(s).search(o)){var c,f=l;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;l=l.slice(0,p===i?s:p)}}else if(e.indexOf(ai(o),s)!=s){var h=l.lastIndexOf(o);h>-1&&(l=l.slice(0,h))}return l+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,as(Ln,(vs={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vs[t]=e)})),vs),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(ns)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,s=t instanceof Un,l=u[0],c=s||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof l&&1!=l.length&&(s=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=s&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,s=a&&u&&"object"==typeof n.g&&n.g;!s||s.global!==s&&s.window!==s&&s.self!==s||(o=s);var l=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=l)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(l=n)?typeof l[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!l[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),s=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!s?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!s?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var s=t[o];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=n[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)lt(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,s=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var l=Vt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(s,l);e.then(c,n)}e=n,s(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function sn(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=l),an(this)){var o=sn(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return l;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=sn(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!sn(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=ln(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=ln(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=ln(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return lr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return lr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var s=r.value;if(!i.has(s))if(n.delete(s))a=!0;else{var l=n.data_.get(s);o.set(s,l)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!sn(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=ln(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!sn(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=ln(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return lr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=sr(e),t=sr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function sr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function lr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var s=a._childNodes[a.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw li(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var s,l,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(s=r.onError,l=n,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw li(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],si));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw li("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(r),s=!0)}s&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw li(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw li(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw li("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw li("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function lo(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new so(e,t,n||co)}var co=[void 0],fo=lo(eo,void 0),po=lo(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw li("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):lo(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Apply a snapshot to a model with a snapshot listener",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=No.model({string:No.string,number:No.number,integer:No.integer,float:No.float,boolean:No.boolean,date:No.Date}).create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date});var n,r,i,o;r=e=>e,Qr(n=t),ei(n).onSnapshot(r),function(e,t){Qr(),ei(e).applySnapshot(t)}(t,mr(t)),i="Apply a snapshot to a model with a snapshot listener",o=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[i]?Ro[i]=Math.max(Ro[i],o):Ro[i]=o})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/apply-a-snapshot-to-a-model-with-a-snapshot-listener-web-bundle.js.LICENSE.txt b/build/apply-a-snapshot-to-a-model-with-a-snapshot-listener-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/apply-a-snapshot-to-a-model-with-a-snapshot-listener-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/apply-patch-to-model-with-simple-patch-listener-bundle-source.js b/build/apply-patch-to-model-with-simple-patch-listener-bundle-source.js new file mode 100644 index 0000000..ae8ca92 --- /dev/null +++ b/build/apply-patch-to-model-with-simple-patch-listener-bundle-source.js @@ -0,0 +1,107 @@ + +import { types, onPatch, applyPatch } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Apply patch to model with simple patch listener", () => { + const startMemory = getStartMemory(); + const Model = types.model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, +}); + +const m = Model.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), +}); + +applyPatch(m, { + op: "replace", + path: "/string", + value: "new string", +}); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Apply patch to model with simple patch listener", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/apply-patch-to-model-with-simple-patch-listener-node-bundle.js b/build/apply-patch-to-model-with-simple-patch-listener-node-bundle.js new file mode 100644 index 0000000..1930035 --- /dev/null +++ b/build/apply-patch-to-model-with-simple-patch-listener-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see apply-patch-to-model-with-simple-patch-listener-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Vt(e){return v(e)&&!0===e.isMobxAction}function Ct(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Vr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Vr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Vr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Vr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Ct((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Vr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Vr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},C(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Vr=P("ObservableMap",Nr),Cr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Cr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Vr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Vr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Vi?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Vi&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Cn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Vn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Cn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Vn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Va=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Ca={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Ci(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Apply patch to model with simple patch listener",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,r;mn(Ca.model({string:Ca.string,number:Ca.number,integer:Ca.integer,float:Ca.float,boolean:Ca.boolean,date:Ca.Date}).create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}),{op:"replace",path:"/string",value:"new string"}),t="Apply patch to model with simple patch listener",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[t]?ka[t]=Math.max(ka[t],r):ka[t]=r})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/apply-patch-to-model-with-simple-patch-listener-node-bundle.js.LICENSE.txt b/build/apply-patch-to-model-with-simple-patch-listener-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/apply-patch-to-model-with-simple-patch-listener-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/apply-patch-to-model-with-simple-patch-listener-web-bundle.js b/build/apply-patch-to-model-with-simple-patch-listener-web-bundle.js new file mode 100644 index 0000000..721bdc1 --- /dev/null +++ b/build/apply-patch-to-model-with-simple-patch-listener-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see apply-patch-to-model-with-simple-patch-listener-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw si("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw si(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw si("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw si("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw si("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw si(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw si("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw si("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw si("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw si("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw si("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw si(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw si(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw si("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw si("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw si("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw si("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw si("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw si("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function so(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw si("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||co)}var co=[void 0],fo=so(eo,void 0),po=so(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw si("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw si("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw si("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw si("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw si("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw si("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):so(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Apply patch to model with simple patch listener",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,n;_r(No.model({string:No.string,number:No.number,integer:No.integer,float:No.float,boolean:No.boolean,date:No.Date}).create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}),{op:"replace",path:"/string",value:"new string"}),t="Apply patch to model with simple patch listener",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[t]?Ro[t]=Math.max(Ro[t],n):Ro[t]=n})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/apply-patch-to-model-with-simple-patch-listener-web-bundle.js.LICENSE.txt b/build/apply-patch-to-model-with-simple-patch-listener-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/apply-patch-to-model-with-simple-patch-listener-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/check-a-reference-and-fail-bundle-source.js b/build/check-a-reference-and-fail-bundle-source.js new file mode 100644 index 0000000..99e3512 --- /dev/null +++ b/build/check-a-reference-and-fail-bundle-source.js @@ -0,0 +1,111 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Check a reference and fail", () => { + const startMemory = getStartMemory(); + const Car = types.model("Car", { + id: types.identifier, +}); + +const CarStore = types.model("CarStore", { + cars: types.array(Car), + selectedCar: types.reference(Car), +}); + +// create a store with a normalized snapshot +const store = CarStore.create({ + cars: [ + { + id: "47", + }, + ], + selectedCar: "47", +}); + +applySnapshot(store, { + ...store, + selectedCar: "48", +}); + +const isValid = isValidReference(() => store.selectedCar); + +return isValid; + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Check a reference and fail", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/check-a-reference-and-fail-node-bundle.js b/build/check-a-reference-and-fail-node-bundle.js new file mode 100644 index 0000000..22c5eb1 --- /dev/null +++ b/build/check-a-reference-and-fail-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see check-a-reference-and-fail-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Xe(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Je(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(X(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=kt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function kt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var Dt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Cr(e)||kr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Xt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):kr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Jt(e,t,n){if(2!==arguments.length||kr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):kr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Jt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||kr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=kt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return kn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Xt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):kr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Xn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Jn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Ci?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=kn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Ci&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function ki(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!ki(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var Di=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(ki(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Xt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return Dn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Jn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;kn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Jn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Jn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){Dn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Ca=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Va={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:kn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return Dn(),new Vi(e,t,r)}};const xa=require("benchmark");var ka=new(e.n(xa)().Suite);const Da={};ka.on("complete",(function(){const e=ka.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Da[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),ka.add("Check a reference and fail",(()=>{void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;const e=Va.model("Car",{id:Va.identifier}),t=Va.model("CarStore",{cars:Va.array(e),selectedCar:Va.reference(e)}).create({cars:[{id:"47"}],selectedCar:"47"});return applySnapshot(t,{...t,selectedCar:"48"}),isValidReference((()=>t.selectedCar))})),ka.on("cycle",(function(e){console.log(String(e.target))})),ka.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/check-a-reference-and-fail-node-bundle.js.LICENSE.txt b/build/check-a-reference-and-fail-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/check-a-reference-and-fail-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/check-a-reference-and-fail-web-bundle.js b/build/check-a-reference-and-fail-web-bundle.js new file mode 100644 index 0000000..474f352 --- /dev/null +++ b/build/check-a-reference-and-fail-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see check-a-reference-and-fail-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw si("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw si(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw si("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw si("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw si("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw si(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw si("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw si("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw si("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw si("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw si("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw si(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw si(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw si("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw si("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw si("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw si("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw si("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw si("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function so(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw si("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||co)}var co=[void 0],fo=so(eo,void 0),po=so(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw si("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw si("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw si("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw si("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw si("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw si("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):so(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Check a reference and fail",(()=>{void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;const e=No.model("Car",{id:No.identifier}),t=No.model("CarStore",{cars:No.array(e),selectedCar:No.reference(e)}).create({cars:[{id:"47"}],selectedCar:"47"});return applySnapshot(t,{...t,selectedCar:"48"}),isValidReference((()=>t.selectedCar))})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/check-a-reference-and-fail-web-bundle.js.LICENSE.txt b/build/check-a-reference-and-fail-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/check-a-reference-and-fail-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/check-a-reference-and-succeed-bundle-source.js b/build/check-a-reference-and-succeed-bundle-source.js new file mode 100644 index 0000000..19cc55c --- /dev/null +++ b/build/check-a-reference-and-succeed-bundle-source.js @@ -0,0 +1,106 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Check a reference and succeed", () => { + const startMemory = getStartMemory(); + const Car = types.model("Car", { + id: types.identifier, +}); + +const CarStore = types.model("CarStore", { + cars: types.array(Car), + selectedCar: types.reference(Car), +}); + +// create a store with a normalized snapshot +const store = CarStore.create({ + cars: [ + { + id: "47", + }, + ], + selectedCar: "47", +}); + +const isValid = isValidReference(() => store.selectedCar); + +return isValid; + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Check a reference and succeed", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/check-a-reference-and-succeed-node-bundle.js b/build/check-a-reference-and-succeed-node-bundle.js new file mode 100644 index 0000000..e12190c --- /dev/null +++ b/build/check-a-reference-and-succeed-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see check-a-reference-and-succeed-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Xe(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Je(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(X(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=kt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function kt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var Dt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Cr(e)||kr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Xt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):kr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Jt(e,t,n){if(2!==arguments.length||kr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):kr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Jt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||kr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=kt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return kn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Xt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):kr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Xn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Jn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Ci?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=kn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Ci&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function ki(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!ki(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var Di=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(ki(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Xt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return Dn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Jn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;kn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Jn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Jn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){Dn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Ca=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Va={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:kn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return Dn(),new Vi(e,t,r)}};const xa=require("benchmark");var ka=new(e.n(xa)().Suite);const Da={};ka.on("complete",(function(){const e=ka.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Da[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),ka.add("Check a reference and succeed",(()=>{void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;const e=Va.model("Car",{id:Va.identifier}),t=Va.model("CarStore",{cars:Va.array(e),selectedCar:Va.reference(e)}).create({cars:[{id:"47"}],selectedCar:"47"});return isValidReference((()=>t.selectedCar))})),ka.on("cycle",(function(e){console.log(String(e.target))})),ka.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/check-a-reference-and-succeed-node-bundle.js.LICENSE.txt b/build/check-a-reference-and-succeed-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/check-a-reference-and-succeed-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/check-a-reference-and-succeed-web-bundle.js b/build/check-a-reference-and-succeed-web-bundle.js new file mode 100644 index 0000000..8f1ba11 --- /dev/null +++ b/build/check-a-reference-and-succeed-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see check-a-reference-and-succeed-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw si("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw si(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw si("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw si("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw si("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw si(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw si("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw si("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw si("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw si("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw si("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw si(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw si(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw si("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw si("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw si("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw si("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw si("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw si("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function so(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw si("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||co)}var co=[void 0],fo=so(eo,void 0),po=so(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw si("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw si("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw si("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw si("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw si("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw si("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):so(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Check a reference and succeed",(()=>{void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;const e=No.model("Car",{id:No.identifier}),t=No.model("CarStore",{cars:No.array(e),selectedCar:No.reference(e)}).create({cars:[{id:"47"}],selectedCar:"47"});return isValidReference((()=>t.selectedCar))})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/check-a-reference-and-succeed-web-bundle.js.LICENSE.txt b/build/check-a-reference-and-succeed-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/check-a-reference-and-succeed-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/check-a-valid-model-with-mst-typecheck-bundle-source.js b/build/check-a-valid-model-with-mst-typecheck-bundle-source.js new file mode 100644 index 0000000..ada5856 --- /dev/null +++ b/build/check-a-valid-model-with-mst-typecheck-bundle-source.js @@ -0,0 +1,119 @@ + +import { types, typecheck } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Check a valid model with MST typecheck", () => { + const startMemory = getStartMemory(); + const ExampleModelMST = types.model({ + id: types.identifier, + name: types.string, + age: types.number, + isHappy: types.boolean, + createdAt: types.Date, + updatedAt: types.maybeNull(types.Date), + favoriteColors: types.array(types.string), + favoriteNumbers: types.array(types.number), + favoriteFoods: types.array( + types.model({ + name: types.string, + calories: types.number, + }) + ), +}); + +const model = ExampleModelMST.create({ + id: "1", + name: "John", + age: 42, + isHappy: true, + createdAt: new Date(), + updatedAt: null, + favoriteColors: ["blue", "green"], + favoriteNumbers: [1, 2, 3], + favoriteFoods: [ + { + name: "Pizza", + calories: 1000, + }, + ], +}); + +typecheck(ExampleModelMST, model); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Check a valid model with MST typecheck", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/check-a-valid-model-with-mst-typecheck-node-bundle.js b/build/check-a-valid-model-with-mst-typecheck-node-bundle.js new file mode 100644 index 0000000..5d28b83 --- /dev/null +++ b/build/check-a-valid-model-with-mst-typecheck-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see check-a-valid-model-with-mst-typecheck-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===J}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,$e(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),Je(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U($(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=kt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function kt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var Dt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function Jt(e){return Br(e)?e[F].keys_():Cr(e)||kr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function $t(e){return Br(e)?Jt(e).map((function(t){return e[t]})):Cr(e)?Jt(e).map((function(t){return e.get(t)})):kr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||kr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):kr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||kr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Yn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw ci("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Na(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Yn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=si,this.state=Yn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=Yn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw ci(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ti(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(ei(i=n.context,1),ti(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(si),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ai(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw ci("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw ci("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ii);if(!(""===e||"."===e||".."===e||Pi(e,"/")||Pi(e,"./")||Pi(e,"../")))throw ci("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ii(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),mi(this.storedValue,"$treenode",this),mi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Yn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=kt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new wi),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ti(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:Oi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Qn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Qn(t)?"value of type "+ti(t).type.name+":":yi(t)?"value":"snapshot",o=r&&Qn(t)&&r.is(ti(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return kn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||yi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return ui}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&qn(e,t)}function qn(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw ci(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}var Yn,Jn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Jn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],li));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw ci("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;$t(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?Jt(n).map((function(e){return[e,n[e]]})):Cr(n)?Jt(n).map((function(e){return[e,n.get(e)]})):kr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw ci("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Xn(e,t,r,n,i){var a=ri(i);if(a){if(a.parent)throw ci("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Zn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Qn(e){return!(!e||!e.$treenode)}function ei(e,t){ji()}function ti(e){if(!Qn(e))throw ci("Value "+e+" is no MST Node");return e.$treenode}function ri(e){return e&&e.$treenode||null}function ni(){return ti(this).snapshot}function ii(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Qn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Qn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Vi?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=kn(e)?this._subtype:Qn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Vi&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),ki="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=hi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Wi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Ri=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw ci("Map.put cannot be used to set empty values");if(Qn(e)){var t=ti(e);if(null===t.identifier)throw ci(ki);return this.set(t.identifier,e),e}if(vi(e)){var r=ti(this),n=r.type;if(n.identifierMode!==Ci.YES)throw ci(ki);var i=e[n.mapIdentifierAttribute];if(!Ca(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Na(i);return this.set(o,e),this.get(o)}throw ci("Map.put can only be used to store complex values")}}),t}(Nr),Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw ci("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Ri(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);mi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return $t(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw ci("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ti(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw ci("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ti(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ti(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ti(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ti(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return di(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return si}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Li.prototype.applySnapshot=Tt(Li.prototype.applySnapshot);var Mi=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},li),{name:this.name});return Ae.array(ai(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);mi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Qn(e)?ti(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),ua=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw ci("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw ci("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function ca(e,t,r){return function(e,t){if("function"!=typeof t&&Qn(t))throw ci("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dn()}(0,t),new la(e,t,r||fa)}var fa=[void 0],pa=ca(ta,void 0),ba=ca(ea,null);function ha(e){return Dn(),sa(e,pa)}var da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw ci("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),va=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Zn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):gi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),ya=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Zn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return gi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ga=new ya,ma=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Ca(e))this.identifier=e;else{if(!Qn(e))throw ci("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ti(e);if(!r.identifierAttribute)throw ci("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw ci("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Na(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new _a("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),_a=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),wa=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Ca(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;kn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ti(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Na(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Yn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),Oa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Qn(n)?(ei(i=n),ti(i).identifier):n,o=new ma(n,this.targetType),u=Zn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Qn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(wa),Pa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Qn(n)?this.options.set(n,e?e.storedValue:null):n,a=Zn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Qn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(wa);function ja(e,t){Dn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Pa(e,{get:r.get,set:r.set},n):new Oa(e,n)}var Sa=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Wi))throw ci("Identifier types can only be instantiated as direct child of a model type");return Zn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw ci("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Aa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(Sa),Ea=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(Sa),Ta=new Aa,Ia=new Ea;function Na(e){return""+e}function Ca(e){return"string"==typeof e||"number"==typeof e}var Va=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Zn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),xa={enumeration:function(e,t){var r="string"==typeof e?t:e,n=sa.apply(void 0,yn(r.map((function(e){return aa(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dn(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ga:kn(e)?new ya(e):ca(ga,e)},identifier:Ta,identifierNumber:Ia,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new da(r,"string"==typeof e?t:e)},lazy:function(e,t){return new va(e,t)},undefined:ta,null:ea,snapshotProcessor:function(e,t,r){return Dn(),new xi(e,t,r)}};const ka=require("benchmark");var Da=new(e.n(ka)().Suite);const Ra={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ra[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Check a valid model with MST typecheck",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=xa.model({id:xa.identifier,name:xa.string,age:xa.number,isHappy:xa.boolean,createdAt:xa.Date,updatedAt:xa.maybeNull(xa.Date),favoriteColors:xa.array(xa.string),favoriteNumbers:xa.array(xa.number),favoriteFoods:xa.array(xa.model({name:xa.string,calories:xa.number}))}),r=t.create({id:"1",name:"John",age:42,isHappy:!0,createdAt:new Date,updatedAt:null,favoriteColors:["blue","green"],favoriteNumbers:[1,2,3],favoriteFoods:[{name:"Pizza",calories:1e3}]});var n,i;qn(t,r),n="Check a valid model with MST typecheck",i=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ra[n]?Ra[n]=Math.max(Ra[n],i):Ra[n]=i})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/check-a-valid-model-with-mst-typecheck-node-bundle.js.LICENSE.txt b/build/check-a-valid-model-with-mst-typecheck-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/check-a-valid-model-with-mst-typecheck-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/check-a-valid-model-with-mst-typecheck-web-bundle.js b/build/check-a-valid-model-with-mst-typecheck-web-bundle.js new file mode 100644 index 0000000..2848fec --- /dev/null +++ b/build/check-a-valid-model-with-mst-typecheck-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see check-a-valid-model-with-mst-typecheck-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Yr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw ci("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Io(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=li,this.state=qr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=qr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw ci(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&Ei(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(ei(i=r.context,1),ti(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(li),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):oi(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw ci("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw ci("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||ji(e,"/")||ji(e,"./")||ji(e,"../")))throw ci("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ii(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),_i(this.storedValue,"$treenode",this),_i(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new wi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ti(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:Oi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Qr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Qr(t)?"value of type "+ti(t).type.name+":":yi(t)?"value":"snapshot",a=n&&Qr(t)&&n.is(ti(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||yi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ui}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&Kr(e,t)}function Kr(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw ci(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}var qr,Xr=0,Yr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Xr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],si));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw ci("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw ci("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Zr(e,t,n,r,i){var o=ni(i);if(o){if(o.parent)throw ci("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Jr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Qr(e){return!(!e||!e.$treenode)}function ei(e,t){Pi()}function ti(e){if(!Qr(e))throw ci("Value "+e+" is no MST Node");return e.$treenode}function ni(e){return e&&e.$treenode||null}function ri(){return ti(this).snapshot}function ii(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Qr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Qr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===ki?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Qr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==ki&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Vi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=bi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Di(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Gi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ii||(Ii={}));var Ri=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw ci("Map.put cannot be used to set empty values");if(Qr(e)){var t=ti(e);if(null===t.identifier)throw ci(Vi);return this.set(t.identifier,e),e}if(vi(e)){var n=ti(this),r=n.type;if(r.identifierMode!==Ii.YES)throw ci(Vi);var i=e[r.mapIdentifierAttribute];if(!ko(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Io(i);return this.set(a,e),this.get(a)}throw ci("Map.put can only be used to store complex values")}}),t}(In),Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ii.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ii.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw ci("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ii.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ii.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Ri(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);_i(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw ci("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ti(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ii.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw ci("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ti(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return di(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return li}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Mi.prototype.applySnapshot=Et(Mi.prototype.applySnapshot);var Li=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},si),{name:this.name});return Ae.array(oi(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);_i(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Qr(e)?ti(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),uo=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw ci("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw ci("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function co(e,t,n){return function(e,t){if("function"!=typeof t&&Qr(t))throw ci("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new so(e,t,n||fo)}var fo=[void 0],po=co(to,void 0),ho=co(eo,null);function bo(e){return Dr(),lo(e,po)}var vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw ci("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),yo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Jr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):gi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),go=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Jr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return gi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),_o=new go,mo=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),ko(e))this.identifier=e;else{if(!Qr(e))throw ci("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ti(e);if(!n.identifierAttribute)throw ci("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw ci("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Io(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new wo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),wo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),Oo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return ko(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ti(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Io(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),jo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Qr(r)?(ei(i=r),ti(i).identifier):r,a=new mo(r,this.targetType),u=Jr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Qr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(Oo),Po=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Qr(r)?this.options.set(r,e?e.storedValue:null):r,o=Jr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Qr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(Oo);function So(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new Po(e,{get:n.get,set:n.set},r):new jo(e,r)}var Ao=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Gi))throw ci("Identifier types can only be instantiated as direct child of a model type");return Jr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw ci("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),xo=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(Ao),Eo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(Ao),To=new xo,Co=new Eo;function Io(e){return""+e}function ko(e){return"string"==typeof e||"number"==typeof e}var No=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Jr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),Vo={enumeration:function(e,t){var n="string"==typeof e?t:e,r=lo.apply(void 0,yr(n.map((function(e){return oo(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?_o:Vr(e)?new go(e):co(_o,e)},identifier:To,identifierNumber:Co,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new vo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new yo(e,t)},undefined:to,null:eo,snapshotProcessor:function(e,t,n){return Dr(),new Ni(e,t,n)}},Do=n(215),Ro=new(n.n(Do)().Suite);const Mo={};Ro.on("complete",(function(){const e=Ro.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Mo[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Ro.add("Check a valid model with MST typecheck",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=Vo.model({id:Vo.identifier,name:Vo.string,age:Vo.number,isHappy:Vo.boolean,createdAt:Vo.Date,updatedAt:Vo.maybeNull(Vo.Date),favoriteColors:Vo.array(Vo.string),favoriteNumbers:Vo.array(Vo.number),favoriteFoods:Vo.array(Vo.model({name:Vo.string,calories:Vo.number}))}),n=t.create({id:"1",name:"John",age:42,isHappy:!0,createdAt:new Date,updatedAt:null,favoriteColors:["blue","green"],favoriteNumbers:[1,2,3],favoriteFoods:[{name:"Pizza",calories:1e3}]});var r,i;Kr(t,n),r="Check a valid model with MST typecheck",i=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Mo[r]?Mo[r]=Math.max(Mo[r],i):Mo[r]=i})),Ro.on("cycle",(function(e){console.log(String(e.target))})),Ro.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/check-a-valid-model-with-mst-typecheck-web-bundle.js.LICENSE.txt b/build/check-a-valid-model-with-mst-typecheck-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/check-a-valid-model-with-mst-typecheck-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/check-a-valid-model-with-zod-typecheck-bundle-source.js b/build/check-a-valid-model-with-zod-typecheck-bundle-source.js new file mode 100644 index 0000000..04f012b --- /dev/null +++ b/build/check-a-valid-model-with-zod-typecheck-bundle-source.js @@ -0,0 +1,119 @@ + +import { z } from "zod"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Check a valid model with Zod typecheck", () => { + const startMemory = getStartMemory(); + const ExampleSchemaZod = z.object({ + id: z.number(), + name: z.string(), + age: z.number(), + isHappy: z.boolean(), + createdAt: z.date(), + updatedAt: z.date().nullable(), + favoriteColors: z.array(z.string()), + favoriteNumbers: z.array(z.number()), + favoriteFoods: z.array( + z.object({ + name: z.string(), + calories: z.number(), + }) + ), +}); + +const schemaSuccess = { + id: 1, + name: "John", + age: 42, + isHappy: true, + createdAt: new Date(), + updatedAt: null, + favoriteColors: ["blue", "green"], + favoriteNumbers: [1, 2, 3], + favoriteFoods: [ + { + name: "Pizza", + calories: 1000, + }, + ], +}; + +ExampleSchemaZod.parse(schemaSuccess); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Check a valid model with Zod typecheck", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/check-a-valid-model-with-zod-typecheck-node-bundle.js b/build/check-a-valid-model-with-zod-typecheck-node-bundle.js new file mode 100644 index 0000000..898d050 --- /dev/null +++ b/build/check-a-valid-model-with-zod-typecheck-node-bundle.js @@ -0,0 +1 @@ +(()=>{"use strict";var e,t,a={n:e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},d:(e,t)=>{for(var s in t)a.o(t,s)&&!a.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},s={};a.r(s),function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const a of e)t[a]=a;return t},e.getValidEnumValues=t=>{const a=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),s={};for(const e of a)s[e]=t[e];return e.objectValues(s)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.push(a);return t},e.find=(e,t)=>{for(const a of e)if(t(a))return a},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(e||(e={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(t||(t={}));const r=e.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),n=e=>{switch(typeof e){case"undefined":return r.undefined;case"string":return r.string;case"number":return isNaN(e)?r.nan:r.number;case"boolean":return r.boolean;case"function":return r.function;case"bigint":return r.bigint;case"symbol":return r.symbol;case"object":return Array.isArray(e)?r.array:null===e?r.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?r.promise:"undefined"!=typeof Map&&e instanceof Map?r.map:"undefined"!=typeof Set&&e instanceof Set?r.set:"undefined"!=typeof Date&&e instanceof Date?r.date:r.object;default:return r.unknown}},i=e.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class o extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},a={_errors:[]},s=e=>{for(const r of e.issues)if("invalid_union"===r.code)r.unionErrors.map(s);else if("invalid_return_type"===r.code)s(r.returnTypeError);else if("invalid_arguments"===r.code)s(r.argumentsError);else if(0===r.path.length)a._errors.push(t(r));else{let e=a,s=0;for(;se.message)){const t={},a=[];for(const s of this.issues)s.path.length>0?(t[s.path[0]]=t[s.path[0]]||[],t[s.path[0]].push(e(s))):a.push(e(s));return{formErrors:a,fieldErrors:t}}get formErrors(){return this.flatten()}}o.create=e=>new o(e);const d=(t,a)=>{let s;switch(t.code){case i.invalid_type:s=t.received===r.undefined?"Required":`Expected ${t.expected}, received ${t.received}`;break;case i.invalid_literal:s=`Invalid literal value, expected ${JSON.stringify(t.expected,e.jsonStringifyReplacer)}`;break;case i.unrecognized_keys:s=`Unrecognized key(s) in object: ${e.joinValues(t.keys,", ")}`;break;case i.invalid_union:s="Invalid input";break;case i.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${e.joinValues(t.options)}`;break;case i.invalid_enum_value:s=`Invalid enum value. Expected ${e.joinValues(t.options)}, received '${t.received}'`;break;case i.invalid_arguments:s="Invalid function arguments";break;case i.invalid_return_type:s="Invalid function return type";break;case i.invalid_date:s="Invalid date";break;case i.invalid_string:"object"==typeof t.validation?"includes"in t.validation?(s=`Invalid input: must include "${t.validation.includes}"`,"number"==typeof t.validation.position&&(s=`${s} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?s=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?s=`Invalid input: must end with "${t.validation.endsWith}"`:e.assertNever(t.validation):s="regex"!==t.validation?`Invalid ${t.validation}`:"Invalid";break;case i.too_small:s="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:"number"===t.type?`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:"date"===t.type?`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:"Invalid input";break;case i.too_big:s="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:"number"===t.type?`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"bigint"===t.type?`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"date"===t.type?`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:"Invalid input";break;case i.custom:s="Invalid input";break;case i.invalid_intersection_types:s="Intersection results could not be merged";break;case i.not_multiple_of:s=`Number must be a multiple of ${t.multipleOf}`;break;case i.not_finite:s="Number must be finite";break;default:s=a.defaultError,e.assertNever(t)}return{message:s}};let c=d;function u(){return c}const l=e=>{const{data:t,path:a,errorMaps:s,issueData:r}=e,n=[...a,...r.path||[]],i={...r,path:n};let o="";const d=s.filter((e=>!!e)).slice().reverse();for(const e of d)o=e(i,{data:t,defaultError:o}).message;return{...r,path:n,message:r.message||o}};function p(e,t){const a=l({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,u(),d].filter((e=>!!e))});e.common.issues.push(a)}class h{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const a=[];for(const s of t){if("aborted"===s.status)return m;"dirty"===s.status&&e.dirty(),a.push(s.value)}return{status:e.value,value:a}}static async mergeObjectAsync(e,t){const a=[];for(const e of t)a.push({key:await e.key,value:await e.value});return h.mergeObjectSync(e,a)}static mergeObjectSync(e,t){const a={};for(const s of t){const{key:t,value:r}=s;if("aborted"===t.status)return m;if("aborted"===r.status)return m;"dirty"===t.status&&e.dirty(),"dirty"===r.status&&e.dirty(),"__proto__"===t.value||void 0===r.value&&!s.alwaysSet||(a[t.value]=r.value)}return{status:e.value,value:a}}}const m=Object.freeze({status:"aborted"}),f=e=>({status:"dirty",value:e}),y=e=>({status:"valid",value:e}),_=e=>"aborted"===e.status,v=e=>"dirty"===e.status,g=e=>"valid"===e.status,x=e=>"undefined"!=typeof Promise&&e instanceof Promise;var b;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(b||(b={}));class k{constructor(e,t,a,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=a,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const w=(e,t)=>{if(g(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new o(e.common.issues);return this._error=t,this._error}}};function Z(e){if(!e)return{};const{errorMap:t,invalid_type_error:a,required_error:s,description:r}=e;if(t&&(a||s))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:r}:{errorMap:(e,t)=>"invalid_type"!==e.code?{message:t.defaultError}:void 0===t.data?{message:null!=s?s:t.defaultError}:{message:null!=a?a:t.defaultError},description:r}}class T{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return n(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:n(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new h,ctx:{common:e.parent.common,data:e.data,parsedType:n(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(x(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const a=this.safeParse(e,t);if(a.success)return a.data;throw a.error}safeParse(e,t){var a;const s={common:{issues:[],async:null!==(a=null==t?void 0:t.async)&&void 0!==a&&a,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:n(e)},r=this._parseSync({data:e,path:s.path,parent:s});return w(s,r)}async parseAsync(e,t){const a=await this.safeParseAsync(e,t);if(a.success)return a.data;throw a.error}async safeParseAsync(e,t){const a={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:n(e)},s=this._parse({data:e,path:a.path,parent:a}),r=await(x(s)?s:Promise.resolve(s));return w(a,r)}refine(e,t){const a=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,s)=>{const r=e(t),n=()=>s.addIssue({code:i.custom,...a(t)});return"undefined"!=typeof Promise&&r instanceof Promise?r.then((e=>!!e||(n(),!1))):!!r||(n(),!1)}))}refinement(e,t){return this._refinement(((a,s)=>!!e(a)||(s.addIssue("function"==typeof t?t(a,s):t),!1)))}_refinement(e){return new pe({schema:this,typeName:Ze.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return he.create(this,this._def)}nullable(){return me.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return q.create(this,this._def)}promise(){return le.create(this,this._def)}or(e){return Y.create([this,e],this._def)}and(e){return ee.create(this,e,this._def)}transform(e){return new pe({...Z(this._def),schema:this,typeName:Ze.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new fe({...Z(this._def),innerType:this,defaultValue:t,typeName:Ze.ZodDefault})}brand(){return new ge({typeName:Ze.ZodBranded,type:this,...Z(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new ye({...Z(this._def),innerType:this,catchValue:t,typeName:Ze.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return xe.create(this,e)}readonly(){return be.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const O=/^c[^\s-]{8,}$/i,S=/^[a-z][a-z0-9]*$/,N=/^[0-9A-HJKMNP-TV-Z]{26}$/,C=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,j=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let E;const I=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,P=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;class R extends T{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==r.string){const e=this._getOrReturnCtx(t);return p(e,{code:i.invalid_type,expected:r.string,received:e.parsedType}),m}const a=new h;let s;for(const r of this._def.checks)if("min"===r.kind)t.data.lengthr.value&&(s=this._getOrReturnCtx(t,s),p(s,{code:i.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),a.dirty());else if("length"===r.kind){const e=t.data.length>r.value,n=t.data.lengthe.test(t)),{validation:t,code:i.invalid_string,...b.errToObj(a)})}_addCheck(e){return new R({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...b.errToObj(e)})}url(e){return this._addCheck({kind:"url",...b.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...b.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...b.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...b.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...b.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...b.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...b.errToObj(e)})}datetime(e){var t;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,...b.errToObj(null==e?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...b.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...b.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...b.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...b.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...b.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...b.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...b.errToObj(t)})}nonempty(e){return this.min(1,b.errToObj(e))}trim(){return new R({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new R({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new R({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.values?a:s;return parseInt(e.toFixed(r).replace(".",""))%parseInt(t.toFixed(r).replace(".",""))/Math.pow(10,r)}R.create=e=>{var t;return new R({checks:[],typeName:Ze.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...Z(e)})};class M extends T{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==r.number){const e=this._getOrReturnCtx(t);return p(e,{code:i.invalid_type,expected:r.number,received:e.parsedType}),m}let a;const s=new h;for(const r of this._def.checks)"int"===r.kind?e.isInteger(t.data)||(a=this._getOrReturnCtx(t,a),p(a,{code:i.invalid_type,expected:"integer",received:"float",message:r.message}),s.dirty()):"min"===r.kind?(r.inclusive?t.datar.value:t.data>=r.value)&&(a=this._getOrReturnCtx(t,a),p(a,{code:i.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),s.dirty()):"multipleOf"===r.kind?0!==A(t.data,r.value)&&(a=this._getOrReturnCtx(t,a),p(a,{code:i.not_multiple_of,multipleOf:r.value,message:r.message}),s.dirty()):"finite"===r.kind?Number.isFinite(t.data)||(a=this._getOrReturnCtx(t,a),p(a,{code:i.not_finite,message:r.message}),s.dirty()):e.assertNever(r);return{status:s.value,value:t.data}}gte(e,t){return this.setLimit("min",e,!0,b.toString(t))}gt(e,t){return this.setLimit("min",e,!1,b.toString(t))}lte(e,t){return this.setLimit("max",e,!0,b.toString(t))}lt(e,t){return this.setLimit("max",e,!1,b.toString(t))}setLimit(e,t,a,s){return new M({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:b.toString(s)}]})}_addCheck(e){return new M({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:b.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:b.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:b.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:b.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:b.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:b.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:b.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:b.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:b.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value"int"===t.kind||"multipleOf"===t.kind&&e.isInteger(t.value)))}get isFinite(){let e=null,t=null;for(const a of this._def.checks){if("finite"===a.kind||"int"===a.kind||"multipleOf"===a.kind)return!0;"min"===a.kind?(null===t||a.value>t)&&(t=a.value):"max"===a.kind&&(null===e||a.valuenew M({checks:[],typeName:Ze.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...Z(e)});class $ extends T{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==r.bigint){const e=this._getOrReturnCtx(t);return p(e,{code:i.invalid_type,expected:r.bigint,received:e.parsedType}),m}let a;const s=new h;for(const r of this._def.checks)"min"===r.kind?(r.inclusive?t.datar.value:t.data>=r.value)&&(a=this._getOrReturnCtx(t,a),p(a,{code:i.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),s.dirty()):"multipleOf"===r.kind?t.data%r.value!==BigInt(0)&&(a=this._getOrReturnCtx(t,a),p(a,{code:i.not_multiple_of,multipleOf:r.value,message:r.message}),s.dirty()):e.assertNever(r);return{status:s.value,value:t.data}}gte(e,t){return this.setLimit("min",e,!0,b.toString(t))}gt(e,t){return this.setLimit("min",e,!1,b.toString(t))}lte(e,t){return this.setLimit("max",e,!0,b.toString(t))}lt(e,t){return this.setLimit("max",e,!1,b.toString(t))}setLimit(e,t,a,s){return new $({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:b.toString(s)}]})}_addCheck(e){return new $({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:b.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:b.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:b.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:b.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:b.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value{var t;return new $({checks:[],typeName:Ze.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...Z(e)})};class L extends T{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==r.boolean){const t=this._getOrReturnCtx(e);return p(t,{code:i.invalid_type,expected:r.boolean,received:t.parsedType}),m}return y(e.data)}}L.create=e=>new L({typeName:Ze.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...Z(e)});class D extends T{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==r.date){const e=this._getOrReturnCtx(t);return p(e,{code:i.invalid_type,expected:r.date,received:e.parsedType}),m}if(isNaN(t.data.getTime()))return p(this._getOrReturnCtx(t),{code:i.invalid_date}),m;const a=new h;let s;for(const r of this._def.checks)"min"===r.kind?t.data.getTime()r.value&&(s=this._getOrReturnCtx(t,s),p(s,{code:i.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),a.dirty()):e.assertNever(r);return{status:a.value,value:new Date(t.data.getTime())}}_addCheck(e){return new D({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:b.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:b.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuenew D({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Ze.ZodDate,...Z(e)});class z extends T{_parse(e){if(this._getType(e)!==r.symbol){const t=this._getOrReturnCtx(e);return p(t,{code:i.invalid_type,expected:r.symbol,received:t.parsedType}),m}return y(e.data)}}z.create=e=>new z({typeName:Ze.ZodSymbol,...Z(e)});class U extends T{_parse(e){if(this._getType(e)!==r.undefined){const t=this._getOrReturnCtx(e);return p(t,{code:i.invalid_type,expected:r.undefined,received:t.parsedType}),m}return y(e.data)}}U.create=e=>new U({typeName:Ze.ZodUndefined,...Z(e)});class V extends T{_parse(e){if(this._getType(e)!==r.null){const t=this._getOrReturnCtx(e);return p(t,{code:i.invalid_type,expected:r.null,received:t.parsedType}),m}return y(e.data)}}V.create=e=>new V({typeName:Ze.ZodNull,...Z(e)});class K extends T{constructor(){super(...arguments),this._any=!0}_parse(e){return y(e.data)}}K.create=e=>new K({typeName:Ze.ZodAny,...Z(e)});class B extends T{constructor(){super(...arguments),this._unknown=!0}_parse(e){return y(e.data)}}B.create=e=>new B({typeName:Ze.ZodUnknown,...Z(e)});class F extends T{_parse(e){const t=this._getOrReturnCtx(e);return p(t,{code:i.invalid_type,expected:r.never,received:t.parsedType}),m}}F.create=e=>new F({typeName:Ze.ZodNever,...Z(e)});class W extends T{_parse(e){if(this._getType(e)!==r.undefined){const t=this._getOrReturnCtx(e);return p(t,{code:i.invalid_type,expected:r.void,received:t.parsedType}),m}return y(e.data)}}W.create=e=>new W({typeName:Ze.ZodVoid,...Z(e)});class q extends T{_parse(e){const{ctx:t,status:a}=this._processInputParams(e),s=this._def;if(t.parsedType!==r.array)return p(t,{code:i.invalid_type,expected:r.array,received:t.parsedType}),m;if(null!==s.exactLength){const e=t.data.length>s.exactLength.value,r=t.data.lengths.maxLength.value&&(p(t,{code:i.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),a.dirty()),t.common.async)return Promise.all([...t.data].map(((e,a)=>s.type._parseAsync(new k(t,e,t.path,a))))).then((e=>h.mergeArray(a,e)));const n=[...t.data].map(((e,a)=>s.type._parseSync(new k(t,e,t.path,a))));return h.mergeArray(a,n)}get element(){return this._def.type}min(e,t){return new q({...this._def,minLength:{value:e,message:b.toString(t)}})}max(e,t){return new q({...this._def,maxLength:{value:e,message:b.toString(t)}})}length(e,t){return new q({...this._def,exactLength:{value:e,message:b.toString(t)}})}nonempty(e){return this.min(1,e)}}function J(e){if(e instanceof H){const t={};for(const a in e.shape){const s=e.shape[a];t[a]=he.create(J(s))}return new H({...e._def,shape:()=>t})}return e instanceof q?new q({...e._def,type:J(e.element)}):e instanceof he?he.create(J(e.unwrap())):e instanceof me?me.create(J(e.unwrap())):e instanceof te?te.create(e.items.map((e=>J(e)))):e}q.create=(e,t)=>new q({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ze.ZodArray,...Z(t)});class H extends T{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const t=this._def.shape(),a=e.objectKeys(t);return this._cached={shape:t,keys:a}}_parse(e){if(this._getType(e)!==r.object){const t=this._getOrReturnCtx(e);return p(t,{code:i.invalid_type,expected:r.object,received:t.parsedType}),m}const{status:t,ctx:a}=this._processInputParams(e),{shape:s,keys:n}=this._getCached(),o=[];if(!(this._def.catchall instanceof F&&"strip"===this._def.unknownKeys))for(const e in a.data)n.includes(e)||o.push(e);const d=[];for(const e of n){const t=s[e],r=a.data[e];d.push({key:{status:"valid",value:e},value:t._parse(new k(a,r,a.path,e)),alwaysSet:e in a.data})}if(this._def.catchall instanceof F){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of o)d.push({key:{status:"valid",value:e},value:{status:"valid",value:a.data[e]}});else if("strict"===e)o.length>0&&(p(a,{code:i.unrecognized_keys,keys:o}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of o){const s=a.data[t];d.push({key:{status:"valid",value:t},value:e._parse(new k(a,s,a.path,t)),alwaysSet:t in a.data})}}return a.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of d){const a=await t.key;e.push({key:a,value:await t.value,alwaysSet:t.alwaysSet})}return e})).then((e=>h.mergeObjectSync(t,e))):h.mergeObjectSync(t,d)}get shape(){return this._def.shape()}strict(e){return b.errToObj,new H({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,a)=>{var s,r,n,i;const o=null!==(n=null===(r=(s=this._def).errorMap)||void 0===r?void 0:r.call(s,t,a).message)&&void 0!==n?n:a.defaultError;return"unrecognized_keys"===t.code?{message:null!==(i=b.errToObj(e).message)&&void 0!==i?i:o}:{message:o}}}:{}})}strip(){return new H({...this._def,unknownKeys:"strip"})}passthrough(){return new H({...this._def,unknownKeys:"passthrough"})}extend(e){return new H({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new H({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ze.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new H({...this._def,catchall:e})}pick(t){const a={};return e.objectKeys(t).forEach((e=>{t[e]&&this.shape[e]&&(a[e]=this.shape[e])})),new H({...this._def,shape:()=>a})}omit(t){const a={};return e.objectKeys(this.shape).forEach((e=>{t[e]||(a[e]=this.shape[e])})),new H({...this._def,shape:()=>a})}deepPartial(){return J(this)}partial(t){const a={};return e.objectKeys(this.shape).forEach((e=>{const s=this.shape[e];t&&!t[e]?a[e]=s:a[e]=s.optional()})),new H({...this._def,shape:()=>a})}required(t){const a={};return e.objectKeys(this.shape).forEach((e=>{if(t&&!t[e])a[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof he;)t=t._def.innerType;a[e]=t}})),new H({...this._def,shape:()=>a})}keyof(){return de(e.objectKeys(this.shape))}}H.create=(e,t)=>new H({shape:()=>e,unknownKeys:"strip",catchall:F.create(),typeName:Ze.ZodObject,...Z(t)}),H.strictCreate=(e,t)=>new H({shape:()=>e,unknownKeys:"strict",catchall:F.create(),typeName:Ze.ZodObject,...Z(t)}),H.lazycreate=(e,t)=>new H({shape:e,unknownKeys:"strip",catchall:F.create(),typeName:Ze.ZodObject,...Z(t)});class Y extends T{_parse(e){const{ctx:t}=this._processInputParams(e),a=this._def.options;if(t.common.async)return Promise.all(a.map((async e=>{const a={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const a of e)if("dirty"===a.result.status)return t.common.issues.push(...a.ctx.common.issues),a.result;const a=e.map((e=>new o(e.ctx.common.issues)));return p(t,{code:i.invalid_union,unionErrors:a}),m}));{let e;const s=[];for(const r of a){const a={...t,common:{...t.common,issues:[]},parent:null},n=r._parseSync({data:t.data,path:t.path,parent:a});if("valid"===n.status)return n;"dirty"!==n.status||e||(e={result:n,ctx:a}),a.common.issues.length&&s.push(a.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const r=s.map((e=>new o(e)));return p(t,{code:i.invalid_union,unionErrors:r}),m}}get options(){return this._def.options}}Y.create=(e,t)=>new Y({options:e,typeName:Ze.ZodUnion,...Z(t)});const G=e=>e instanceof ie?G(e.schema):e instanceof pe?G(e.innerType()):e instanceof oe?[e.value]:e instanceof ce?e.options:e instanceof ue?Object.keys(e.enum):e instanceof fe?G(e._def.innerType):e instanceof U?[void 0]:e instanceof V?[null]:null;class X extends T{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==r.object)return p(t,{code:i.invalid_type,expected:r.object,received:t.parsedType}),m;const a=this.discriminator,s=t.data[a],n=this.optionsMap.get(s);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):(p(t,{code:i.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),m)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,a){const s=new Map;for(const a of t){const t=G(a.shape[e]);if(!t)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const r of t){if(s.has(r))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(r)}`);s.set(r,a)}}return new X({typeName:Ze.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...Z(a)})}}function Q(t,a){const s=n(t),i=n(a);if(t===a)return{valid:!0,data:t};if(s===r.object&&i===r.object){const s=e.objectKeys(a),r=e.objectKeys(t).filter((e=>-1!==s.indexOf(e))),n={...t,...a};for(const e of r){const s=Q(t[e],a[e]);if(!s.valid)return{valid:!1};n[e]=s.data}return{valid:!0,data:n}}if(s===r.array&&i===r.array){if(t.length!==a.length)return{valid:!1};const e=[];for(let s=0;s{if(_(e)||_(s))return m;const r=Q(e.value,s.value);return r.valid?((v(e)||v(s))&&t.dirty(),{status:t.value,value:r.data}):(p(a,{code:i.invalid_intersection_types}),m)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then((([e,t])=>s(e,t))):s(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}}ee.create=(e,t,a)=>new ee({left:e,right:t,typeName:Ze.ZodIntersection,...Z(a)});class te extends T{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==r.array)return p(a,{code:i.invalid_type,expected:r.array,received:a.parsedType}),m;if(a.data.lengththis._def.items.length&&(p(a,{code:i.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const s=[...a.data].map(((e,t)=>{const s=this._def.items[t]||this._def.rest;return s?s._parse(new k(a,e,a.path,t)):null})).filter((e=>!!e));return a.common.async?Promise.all(s).then((e=>h.mergeArray(t,e))):h.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new te({...this._def,rest:e})}}te.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new te({items:e,typeName:Ze.ZodTuple,rest:null,...Z(t)})};class ae extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==r.object)return p(a,{code:i.invalid_type,expected:r.object,received:a.parsedType}),m;const s=[],n=this._def.keyType,o=this._def.valueType;for(const e in a.data)s.push({key:n._parse(new k(a,e,a.path,e)),value:o._parse(new k(a,a.data[e],a.path,e))});return a.common.async?h.mergeObjectAsync(t,s):h.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,a){return new ae(t instanceof T?{keyType:e,valueType:t,typeName:Ze.ZodRecord,...Z(a)}:{keyType:R.create(),valueType:e,typeName:Ze.ZodRecord,...Z(t)})}}class se extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==r.map)return p(a,{code:i.invalid_type,expected:r.map,received:a.parsedType}),m;const s=this._def.keyType,n=this._def.valueType,o=[...a.data.entries()].map((([e,t],r)=>({key:s._parse(new k(a,e,a.path,[r,"key"])),value:n._parse(new k(a,t,a.path,[r,"value"]))})));if(a.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const a of o){const s=await a.key,r=await a.value;if("aborted"===s.status||"aborted"===r.status)return m;"dirty"!==s.status&&"dirty"!==r.status||t.dirty(),e.set(s.value,r.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const a of o){const s=a.key,r=a.value;if("aborted"===s.status||"aborted"===r.status)return m;"dirty"!==s.status&&"dirty"!==r.status||t.dirty(),e.set(s.value,r.value)}return{status:t.value,value:e}}}}se.create=(e,t,a)=>new se({valueType:t,keyType:e,typeName:Ze.ZodMap,...Z(a)});class re extends T{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==r.set)return p(a,{code:i.invalid_type,expected:r.set,received:a.parsedType}),m;const s=this._def;null!==s.minSize&&a.data.sizes.maxSize.value&&(p(a,{code:i.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const n=this._def.valueType;function o(e){const a=new Set;for(const s of e){if("aborted"===s.status)return m;"dirty"===s.status&&t.dirty(),a.add(s.value)}return{status:t.value,value:a}}const d=[...a.data.values()].map(((e,t)=>n._parse(new k(a,e,a.path,t))));return a.common.async?Promise.all(d).then((e=>o(e))):o(d)}min(e,t){return new re({...this._def,minSize:{value:e,message:b.toString(t)}})}max(e,t){return new re({...this._def,maxSize:{value:e,message:b.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}re.create=(e,t)=>new re({valueType:e,minSize:null,maxSize:null,typeName:Ze.ZodSet,...Z(t)});class ne extends T{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==r.function)return p(t,{code:i.invalid_type,expected:r.function,received:t.parsedType}),m;function a(e,a){return l({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,u(),d].filter((e=>!!e)),issueData:{code:i.invalid_arguments,argumentsError:a}})}function s(e,a){return l({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,u(),d].filter((e=>!!e)),issueData:{code:i.invalid_return_type,returnTypeError:a}})}const n={errorMap:t.common.contextualErrorMap},c=t.data;if(this._def.returns instanceof le){const e=this;return y((async function(...t){const r=new o([]),i=await e._def.args.parseAsync(t,n).catch((e=>{throw r.addIssue(a(t,e)),r})),d=await Reflect.apply(c,this,i);return await e._def.returns._def.type.parseAsync(d,n).catch((e=>{throw r.addIssue(s(d,e)),r}))}))}{const e=this;return y((function(...t){const r=e._def.args.safeParse(t,n);if(!r.success)throw new o([a(t,r.error)]);const i=Reflect.apply(c,this,r.data),d=e._def.returns.safeParse(i,n);if(!d.success)throw new o([s(i,d.error)]);return d.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ne({...this._def,args:te.create(e).rest(B.create())})}returns(e){return new ne({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,a){return new ne({args:e||te.create([]).rest(B.create()),returns:t||B.create(),typeName:Ze.ZodFunction,...Z(a)})}}class ie extends T{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}ie.create=(e,t)=>new ie({getter:e,typeName:Ze.ZodLazy,...Z(t)});class oe extends T{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return p(t,{received:t.data,code:i.invalid_literal,expected:this._def.value}),m}return{status:"valid",value:e.data}}get value(){return this._def.value}}function de(e,t){return new ce({values:e,typeName:Ze.ZodEnum,...Z(t)})}oe.create=(e,t)=>new oe({value:e,typeName:Ze.ZodLiteral,...Z(t)});class ce extends T{_parse(t){if("string"!=typeof t.data){const a=this._getOrReturnCtx(t),s=this._def.values;return p(a,{expected:e.joinValues(s),received:a.parsedType,code:i.invalid_type}),m}if(-1===this._def.values.indexOf(t.data)){const e=this._getOrReturnCtx(t),a=this._def.values;return p(e,{received:e.data,code:i.invalid_enum_value,options:a}),m}return y(t.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e){return ce.create(e)}exclude(e){return ce.create(this.options.filter((t=>!e.includes(t))))}}ce.create=de;class ue extends T{_parse(t){const a=e.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(t);if(s.parsedType!==r.string&&s.parsedType!==r.number){const t=e.objectValues(a);return p(s,{expected:e.joinValues(t),received:s.parsedType,code:i.invalid_type}),m}if(-1===a.indexOf(t.data)){const t=e.objectValues(a);return p(s,{received:s.data,code:i.invalid_enum_value,options:t}),m}return y(t.data)}get enum(){return this._def.values}}ue.create=(e,t)=>new ue({values:e,typeName:Ze.ZodNativeEnum,...Z(t)});class le extends T{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==r.promise&&!1===t.common.async)return p(t,{code:i.invalid_type,expected:r.promise,received:t.parsedType}),m;const a=t.parsedType===r.promise?t.data:Promise.resolve(t.data);return y(a.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}le.create=(e,t)=>new le({type:e,typeName:Ze.ZodPromise,...Z(t)});class pe extends T{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ze.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:a,ctx:s}=this._processInputParams(t),r=this._def.effect||null,n={addIssue:e=>{p(s,e),e.fatal?a.abort():a.dirty()},get path(){return s.path}};if(n.addIssue=n.addIssue.bind(n),"preprocess"===r.type){const e=r.transform(s.data,n);return s.common.issues.length?{status:"dirty",value:s.data}:s.common.async?Promise.resolve(e).then((e=>this._def.schema._parseAsync({data:e,path:s.path,parent:s}))):this._def.schema._parseSync({data:e,path:s.path,parent:s})}if("refinement"===r.type){const e=e=>{const t=r.refinement(e,n);if(s.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===s.common.async){const t=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return"aborted"===t.status?m:("dirty"===t.status&&a.dirty(),e(t.value),{status:a.value,value:t.value})}return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then((t=>"aborted"===t.status?m:("dirty"===t.status&&a.dirty(),e(t.value).then((()=>({status:a.value,value:t.value}))))))}if("transform"===r.type){if(!1===s.common.async){const e=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!g(e))return e;const t=r.transform(e.value,n);if(t instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:a.value,value:t}}return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then((e=>g(e)?Promise.resolve(r.transform(e.value,n)).then((e=>({status:a.value,value:e}))):e))}e.assertNever(r)}}pe.create=(e,t,a)=>new pe({schema:e,typeName:Ze.ZodEffects,effect:t,...Z(a)}),pe.createWithPreprocess=(e,t,a)=>new pe({schema:t,effect:{type:"preprocess",transform:e},typeName:Ze.ZodEffects,...Z(a)});class he extends T{_parse(e){return this._getType(e)===r.undefined?y(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}he.create=(e,t)=>new he({innerType:e,typeName:Ze.ZodOptional,...Z(t)});class me extends T{_parse(e){return this._getType(e)===r.null?y(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}me.create=(e,t)=>new me({innerType:e,typeName:Ze.ZodNullable,...Z(t)});class fe extends T{_parse(e){const{ctx:t}=this._processInputParams(e);let a=t.data;return t.parsedType===r.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}fe.create=(e,t)=>new fe({innerType:e,typeName:Ze.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...Z(t)});class ye extends T{_parse(e){const{ctx:t}=this._processInputParams(e),a={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return x(s)?s.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new o(a.common.issues)},input:a.data})}))):{status:"valid",value:"valid"===s.status?s.value:this._def.catchValue({get error(){return new o(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}}ye.create=(e,t)=>new ye({innerType:e,typeName:Ze.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...Z(t)});class _e extends T{_parse(e){if(this._getType(e)!==r.nan){const t=this._getOrReturnCtx(e);return p(t,{code:i.invalid_type,expected:r.nan,received:t.parsedType}),m}return{status:"valid",value:e.data}}}_e.create=e=>new _e({typeName:Ze.ZodNaN,...Z(e)});const ve=Symbol("zod_brand");class ge extends T{_parse(e){const{ctx:t}=this._processInputParams(e),a=t.data;return this._def.type._parse({data:a,path:t.path,parent:t})}unwrap(){return this._def.type}}class xe extends T{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return"aborted"===e.status?m:"dirty"===e.status?(t.dirty(),f(e.value)):this._def.out._parseAsync({data:e.value,path:a.path,parent:a})})();{const e=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===e.status?m:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:a.path,parent:a})}}static create(e,t){return new xe({in:e,out:t,typeName:Ze.ZodPipeline})}}class be extends T{_parse(e){const t=this._def.innerType._parse(e);return g(t)&&(t.value=Object.freeze(t.value)),t}}be.create=(e,t)=>new be({innerType:e,typeName:Ze.ZodReadonly,...Z(t)});const ke=(e,t={},a)=>e?K.create().superRefine(((s,r)=>{var n,i;if(!e(s)){const e="function"==typeof t?t(s):"string"==typeof t?{message:t}:t,o=null===(i=null!==(n=e.fatal)&&void 0!==n?n:a)||void 0===i||i,d="string"==typeof e?{message:e}:e;r.addIssue({code:"custom",...d,fatal:o})}})):K.create(),we={object:H.lazycreate};var Ze;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Ze||(Ze={}));const Te=R.create,Oe=M.create,Se=_e.create,Ne=$.create,Ce=L.create,je=D.create,Ee=z.create,Ie=U.create,Pe=V.create,Re=K.create,Ae=B.create,Me=F.create,$e=W.create,Le=q.create,De=H.create,ze=H.strictCreate,Ue=Y.create,Ve=X.create,Ke=ee.create,Be=te.create,Fe=ae.create,We=se.create,qe=re.create,Je=ne.create,He=ie.create,Ye=oe.create,Ge=ce.create,Xe=ue.create,Qe=le.create,et=pe.create,tt=he.create,at=me.create,st=pe.createWithPreprocess,rt=xe.create,nt={string:e=>R.create({...e,coerce:!0}),number:e=>M.create({...e,coerce:!0}),boolean:e=>L.create({...e,coerce:!0}),bigint:e=>$.create({...e,coerce:!0}),date:e=>D.create({...e,coerce:!0})},it=m;var ot=Object.freeze({__proto__:null,defaultErrorMap:d,setErrorMap:function(e){c=e},getErrorMap:u,makeIssue:l,EMPTY_PATH:[],addIssueToContext:p,ParseStatus:h,INVALID:m,DIRTY:f,OK:y,isAborted:_,isDirty:v,isValid:g,isAsync:x,get util(){return e},get objectUtil(){return t},ZodParsedType:r,getParsedType:n,ZodType:T,ZodString:R,ZodNumber:M,ZodBigInt:$,ZodBoolean:L,ZodDate:D,ZodSymbol:z,ZodUndefined:U,ZodNull:V,ZodAny:K,ZodUnknown:B,ZodNever:F,ZodVoid:W,ZodArray:q,ZodObject:H,ZodUnion:Y,ZodDiscriminatedUnion:X,ZodIntersection:ee,ZodTuple:te,ZodRecord:ae,ZodMap:se,ZodSet:re,ZodFunction:ne,ZodLazy:ie,ZodLiteral:oe,ZodEnum:ce,ZodNativeEnum:ue,ZodPromise:le,ZodEffects:pe,ZodTransformer:pe,ZodOptional:he,ZodNullable:me,ZodDefault:fe,ZodCatch:ye,ZodNaN:_e,BRAND:ve,ZodBranded:ge,ZodPipeline:xe,ZodReadonly:be,custom:ke,Schema:T,ZodSchema:T,late:we,get ZodFirstPartyTypeKind(){return Ze},coerce:nt,any:Re,array:Le,bigint:Ne,boolean:Ce,date:je,discriminatedUnion:Ve,effect:et,enum:Ge,function:Je,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>ke((t=>t instanceof e),t),intersection:Ke,lazy:He,literal:Ye,map:We,nan:Se,nativeEnum:Xe,never:Me,null:Pe,nullable:at,number:Oe,object:De,oboolean:()=>Ce().optional(),onumber:()=>Oe().optional(),optional:tt,ostring:()=>Te().optional(),pipeline:rt,preprocess:st,promise:Qe,record:Fe,set:qe,strictObject:ze,string:Te,symbol:Ee,transformer:et,tuple:Be,undefined:Ie,union:Ue,unknown:Ae,void:$e,NEVER:it,ZodIssueCode:i,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:o});const dt=require("benchmark");var ct=new(a.n(dt)().Suite);const ut={};ct.on("complete",(function(){const e=ct.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ut[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),ct.add("Check a valid model with Zod typecheck",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=ot.object({id:ot.number(),name:ot.string(),age:ot.number(),isHappy:ot.boolean(),createdAt:ot.date(),updatedAt:ot.date().nullable(),favoriteColors:ot.array(ot.string()),favoriteNumbers:ot.array(ot.number()),favoriteFoods:ot.array(ot.object({name:ot.string(),calories:ot.number()}))}),a={id:1,name:"John",age:42,isHappy:!0,createdAt:new Date,updatedAt:null,favoriteColors:["blue","green"],favoriteNumbers:[1,2,3],favoriteFoods:[{name:"Pizza",calories:1e3}]};var s,r;t.parse(a),s="Check a valid model with Zod typecheck",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ut[s]?ut[s]=Math.max(ut[s],r):ut[s]=r})),ct.on("cycle",(function(e){console.log(String(e.target))})),ct.run(),module.exports.suite=s})(); \ No newline at end of file diff --git a/build/check-a-valid-model-with-zod-typecheck-web-bundle.js b/build/check-a-valid-model-with-zod-typecheck-web-bundle.js new file mode 100644 index 0000000..8ee8c80 --- /dev/null +++ b/build/check-a-valid-model-with-zod-typecheck-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see check-a-valid-model-with-zod-typecheck-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var a,o={function:!0,object:!0},s=o[typeof window]&&window||this,u=(n.amdD,o[typeof t]&&t&&!t.nodeType&&t),c=o.object&&e&&!e.nodeType&&e,l=u&&c&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(s=l);var f=0,d=(c&&c.exports,/^(?:boolean|number|string|undefined)$/),p=0,h=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],m={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},g={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function _(e){var t=e&&e._||Y("lodash")||s._;if(!t)return W.runInContext=_,W;(e=e?t.defaults(s.Object(),e,t.pick(s,h)):s).Array;var r=e.Date,i=e.Function,o=e.Math,c=e.Object,l=(e.RegExp,e.String),y=[],b=c.prototype,x=o.abs,w=e.clearTimeout,k=o.floor,S=(o.log,o.max),O=o.min,T=o.pow,E=y.push,j=(e.setTimeout,y.shift),C=y.slice,A=o.sqrt,Z=(b.toString,y.unshift),I=Y,R=X(e,"document")&&e.document,N=I("microtime"),P=X(e,"process")&&e.process,M=R&&R.createElement("div"),$="uid"+t.now(),z={},B={};!function(){B.browser=R&&X(e,"navigator")&&!X(e,"phantom"),B.timeout=X(e,"setTimeout")&&X(e,"clearTimeout");try{B.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){B.decompilation=!1}}();var L={ns:r,start:null,stop:null};function W(e,n,r){var i=this;if(!(i instanceof W))return new W(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=V(i.stats),i.times=V(i.times)}function D(e){var t=this;if(!(t instanceof D))return new D(e);t.benchmark=e,ce(t)}function F(e){return e instanceof F?e:this instanceof F?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new F(e)}function U(e,n){var r=this;if(!(r instanceof U))return new U(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var V=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function K(){return K=function(e,t){var r,i=n.amdD?n.amdO:W,a=$+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+a+"=function("+e+"){"+t+"}"),r=i[a],delete i[a],r},(K=B.browser&&(K("",'return"'+$+'"')||t.noop)()==$?K:i).apply(null,arguments)}function q(e,n){e._timerId=t.delay(n,1e3*e.delay)}function G(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function H(e){var n="";return J(e)?n=l(e):B.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function X(e,t){if(null==e)return!1;var n=typeof e[t];return!(d.test(n)||"object"==n&&!e[t])}function J(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function Y(e){try{var t=u&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:W,r=R.createElement("script"),i=R.getElementsByTagName("script")[0],a=i.parentNode,o=$+"runScript",s="("+(n.amdD?"define.amd.":"Benchmark.")+o+"||function(){})();";try{r.appendChild(R.createTextNode(s+e)),t[o]=function(){var e;e=r,M.appendChild(e),M.innerHTML=""}}catch(t){a=a.cloneNode(!1),i=null,r.text=e}a.insertBefore(r,i),delete t[o]}function ee(e,n){n=e.options=t.assign({},V(e.constructor.options),V(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=V(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=l(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,o,s=-1,u={currentTarget:e},c={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},l=t.toArray(e);function f(){var e,o=p(i);return o&&(i.on("complete",d),(e=i.events.complete).splice(0,0,e.pop())),l[s]=t.isFunction(i&&i[n])?i[n].apply(i,r):a,!o&&d()}function d(t){var n,r=i,a=p(r);if(a&&(r.off("complete",d),r.emit("complete")),u.type="cycle",u.target=r,n=F(u),c.onCycle.call(e,n),n.aborted||!1===h())u.type="complete",c.onComplete.call(e,F(u));else if(p(i=o?e[0]:l[s]))q(i,f);else{if(!a)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function p(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof W&&((null==t?e.options.async:t)&&B.timeout||e.defer)}function h(){return s++,o&&s>0&&j.call(e),(o?e.length:s>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(o?e:t+r+e)})),i.join(n||",")}function ae(e){var n,r=this,i=F(e),a=r.events,o=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,a&&(n=t.has(a,i.type)&&a[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,o))&&(i.cancelled=!0),!i.aborted})),i.result}function oe(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function se(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var a;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(a=t.indexOf(e,n))>-1&&e.splice(a,1):e.length=0)})),r):r}function ue(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function ce(){var n=W.options,r={},i=[{ns:L.ns,res:S(.0015,o("ms")),unit:"ms"}];function a(e,n,i,a){var o=e.fn,u=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(o)||"deferred":"";return r.uid=$+p++,t.assign(r,{setup:n?H(e.setup):s("m#.setup()"),fn:n?H(o):s("m#.fn("+u+")"),fnArg:u,teardown:n?H(e.teardown):s("m#.teardown()")}),"ns"==L.unit?t.assign(r,{begin:s("s#=n#()"),end:s("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==L.unit?L.ns.stop?t.assign(r,{begin:s("s#=n#.start()"),end:s("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:s("s#=n#()"),end:s("r#=(n#()-s#)/1e6")}):L.ns.now?t.assign(r,{begin:s("s#=n#.now()"),end:s("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:s("s#=new n#().getTime()"),end:s("r#=(new n#().getTime()-s#)/1e3")}),L.start=K(s("o#"),s("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),L.stop=K(s("o#"),s("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),K(s("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+s(a))}function o(e){for(var t,n,r=30,i=1e3,a=L.ns,o=[];r--;){if("us"==e)if(i=1e6,a.stop)for(a.start();!(t=a.microseconds()););else for(n=a();!(t=a()-n););else if("ns"==e){for(i=1e9,n=(n=a())[0]+n[1]/i;!(t=(t=a())[0]+t[1]/i-n););i=1}else if(a.now)for(n=a.now();!(t=a.now()-n););else for(n=(new a).getTime();!(t=(new a).getTime()-n););if(!(t>0)){o.push(1/0);break}o.push(t)}return G(o)/i}function s(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}ce=function(i){var o;i instanceof D&&(i=(o=i).benchmark);var s=i._original,u=J(s.fn),c=s.count=i.count,f=u||B.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),d=s.id,p=s.name||("number"==typeof d?"":d),h=0;i.minTime=s.minTime||(s.minTime=s.options.minTime=n.minTime);var m=o?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=s.compiled=i.compiled=a(s,f,o,m),g=!(r.fn||u);try{if(g)throw new Error('The test "'+p+'" is empty. This may be the result of dead code removal.');o||(s.count=1,v=f&&(v.call(s,e,L)||{}).uid==r.uid&&v,s.count=c)}catch(e){v=null,i.error=e||new Error(l(e)),s.count=c}if(!v&&!o&&!g){v=a(s,f,o,m=(u||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{s.count=1,v.call(s,e,L),s.count=c,delete i.error}catch(e){s.count=c,i.error||(i.error=e||new Error(l(e)))}}return i.error||(h=(v=s.compiled=i.compiled=a(s,f,o,m)).call(o||s,e,L).elapsed),h};try{(L.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:L.ns,res:o("us"),unit:"us"})}catch(e){}if(P&&"function"==typeof(L.ns=P.hrtime)&&i.push({ns:L.ns,res:o("ns"),unit:"ns"}),N&&"function"==typeof(L.ns=N.now)&&i.push({ns:L.ns,res:o("us"),unit:"us"}),(L=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=S(L.res/2/.01,.05)),ce.apply(null,arguments)}function le(t,n){var r;n||(n={}),t instanceof D&&(r=t,t=t.benchmark);var i,a,s,u,c,l,f=n.async,d=t._original,p=t.count,h=t.times;t.running&&(a=++t.cycles,i=r?r.elapsed:ce(t),c=t.minTime,a>d.cycles&&(d.cycles=a),t.error&&((u=F("error")).message=t.error,t.emit(u),u.cancelled||t.abort())),t.running&&(d.times.cycle=h.cycle=i,l=d.times.period=h.period=i/p,d.hz=t.hz=1/l,d.initCount=t.initCount=p,t.running=ie?0:n30?(n=function(e){return(e-a*o/2)/A(a*o*(a+o+1)/12)}(f),x(n)>1.96?f==c?1:-1:0):f<=(s<5||u<3?0:g[s][u-3])?f==c?1:-1:0},emit:ae,listeners:oe,off:se,on:ue,reset:function(){var e=this;if(e.running&&!z.abort)return z.reset=!0,e.abort(),delete z.reset,e;var n,r=0,i=[],o=[],s={destination:e,source:t.assign({},V(e.constructor.prototype),V(e.options))};do{t.forOwn(s.source,(function(e,n){var r,u=s.destination,c=u[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(c)||(r=!0,c=[]),c.length!=e.length&&(r=!0,(c=c.slice(0,e.length)).length=e.length)):t.isObjectLike(c)||(r=!0,c={}),r&&i.push({destination:u,key:n,value:c}),o.push({destination:c,source:e})):t.eq(c,e)||e===a||i.push({destination:u,key:n,value:e}))}))}while(s=o[r++]);return i.length&&(e.emit(n=F("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=F("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&B.timeout},n._original?n.defer?D(n):le(n,e):function(e,n){n||(n={});var r=n.async,i=0,a=e.initCount,s=e.minSamples,u=[],c=e.stats.sample;function l(){u.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}l(),re(u,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,d,p,h,m,g,_=n.target,y=e.aborted,b=t.now(),x=c.push(_.times.period),w=x>=s&&(i+=b-_.times.timeStamp)/1e3>e.maxTime,k=e.times;(y||_.hz==1/0)&&(w=!(x=c.length=u.length=0)),y||(f=G(c),g=t.reduce(c,(function(e,t){return e+T(t-f,2)}),0)/(x-1)||0,r=x-1,p=(d=(m=(h=A(g))/A(x))*(v[o.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:h,mean:f,moe:d,rme:p,sem:m,variance:g}),w&&(e.initCount=a,e.running=!1,y=!0,k.elapsed=(b-k.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,k.cycle=f*e.count,k.period=f)),u.length<2&&!w&&l(),n.aborted=y},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,a=e.stats,o=a.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):l(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+a.rme.toFixed(2)+"% ("+o+" run"+(1==o?"":"s")+" sampled)")}}),t.assign(D.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(D.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,le(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,a="Expected a function",o="__lodash_hash_undefined__",s="__lodash_placeholder__",u=32,c=128,l=1/0,f=9007199254740991,d=NaN,p=4294967295,h=[["ary",c],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",u],["partialRight",64],["rearg",256]],m="[object Arguments]",v="[object Array]",g="[object Boolean]",_="[object Date]",y="[object Error]",b="[object Function]",x="[object GeneratorFunction]",w="[object Map]",k="[object Number]",S="[object Object]",O="[object Promise]",T="[object RegExp]",E="[object Set]",j="[object String]",C="[object Symbol]",A="[object WeakMap]",Z="[object ArrayBuffer]",I="[object DataView]",R="[object Float32Array]",N="[object Float64Array]",P="[object Int8Array]",M="[object Int16Array]",$="[object Int32Array]",z="[object Uint8Array]",B="[object Uint8ClampedArray]",L="[object Uint16Array]",W="[object Uint32Array]",D=/\b__p \+= '';/g,F=/\b(__p \+=) '' \+/g,U=/(__e\(.*?\)|\b__t\)) \+\n'';/g,V=/&(?:amp|lt|gt|quot|#39);/g,K=/[&<>"']/g,q=RegExp(V.source),G=RegExp(K.source),H=/<%-([\s\S]+?)%>/g,X=/<%([\s\S]+?)%>/g,J=/<%=([\s\S]+?)%>/g,Y=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,ae=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,oe=/\{\n\/\* \[wrapped with (.+)\] \*/,se=/,? & /,ue=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ce=/[()=,{}\[\]\/\s]/,le=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,de=/\w*$/,pe=/^[-+]0x[0-9a-f]+$/i,he=/^0b[01]+$/i,me=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ge=/^(?:0|[1-9]\d*)$/,_e=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ye=/($^)/,be=/['\n\r\u2028\u2029\\]/g,xe="\\ud800-\\udfff",we="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",ke="\\u2700-\\u27bf",Se="a-z\\xdf-\\xf6\\xf8-\\xff",Oe="A-Z\\xc0-\\xd6\\xd8-\\xde",Te="\\ufe0e\\ufe0f",Ee="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",je="["+xe+"]",Ce="["+Ee+"]",Ae="["+we+"]",Ze="\\d+",Ie="["+ke+"]",Re="["+Se+"]",Ne="[^"+xe+Ee+Ze+ke+Se+Oe+"]",Pe="\\ud83c[\\udffb-\\udfff]",Me="[^"+xe+"]",$e="(?:\\ud83c[\\udde6-\\uddff]){2}",ze="[\\ud800-\\udbff][\\udc00-\\udfff]",Be="["+Oe+"]",Le="\\u200d",We="(?:"+Re+"|"+Ne+")",De="(?:"+Be+"|"+Ne+")",Fe="(?:['’](?:d|ll|m|re|s|t|ve))?",Ue="(?:['’](?:D|LL|M|RE|S|T|VE))?",Ve="(?:"+Ae+"|"+Pe+")?",Ke="["+Te+"]?",qe=Ke+Ve+"(?:"+Le+"(?:"+[Me,$e,ze].join("|")+")"+Ke+Ve+")*",Ge="(?:"+[Ie,$e,ze].join("|")+")"+qe,He="(?:"+[Me+Ae+"?",Ae,$e,ze,je].join("|")+")",Xe=RegExp("['’]","g"),Je=RegExp(Ae,"g"),Ye=RegExp(Pe+"(?="+Pe+")|"+He+qe,"g"),Qe=RegExp([Be+"?"+Re+"+"+Fe+"(?="+[Ce,Be,"$"].join("|")+")",De+"+"+Ue+"(?="+[Ce,Be+We,"$"].join("|")+")",Be+"?"+We+"+"+Fe,Be+"+"+Ue,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ze,Ge].join("|"),"g"),et=RegExp("["+Le+xe+we+Te+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[R]=it[N]=it[P]=it[M]=it[$]=it[z]=it[B]=it[L]=it[W]=!0,it[m]=it[v]=it[Z]=it[g]=it[I]=it[_]=it[y]=it[b]=it[w]=it[k]=it[S]=it[T]=it[E]=it[j]=it[A]=!1;var at={};at[m]=at[v]=at[Z]=at[I]=at[g]=at[_]=at[R]=at[N]=at[P]=at[M]=at[$]=at[w]=at[k]=at[S]=at[T]=at[E]=at[j]=at[C]=at[z]=at[B]=at[L]=at[W]=!0,at[y]=at[b]=at[A]=!1;var ot={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},st=parseFloat,ut=parseInt,ct="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,lt="object"==typeof self&&self&&self.Object===Object&&self,ft=ct||lt||Function("return this")(),dt=t&&!t.nodeType&&t,pt=dt&&e&&!e.nodeType&&e,ht=pt&&pt.exports===dt,mt=ht&&ct.process,vt=function(){try{return pt&&pt.require&&pt.require("util").types||mt&&mt.binding&&mt.binding("util")}catch(e){}}(),gt=vt&&vt.isArrayBuffer,_t=vt&&vt.isDate,yt=vt&&vt.isMap,bt=vt&&vt.isRegExp,xt=vt&&vt.isSet,wt=vt&&vt.isTypedArray;function kt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function St(e,t,n,r){for(var i=-1,a=null==e?0:e.length;++i-1}function At(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&Bt(t,e[n],0)>-1;);return n}var en=Ut({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=Ut({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+ot[e]}function rn(e){return et.test(e)}function an(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function on(e,t){return function(n){return e(t(n))}}function sn(e,t){for(var n=-1,r=e.length,i=0,a=[];++n",""":'"',"'":"'"}),hn=function e(t){var n,r=(t=null==t?ft:hn.defaults(ft.Object(),t,hn.pick(ft,nt))).Array,ie=t.Date,xe=t.Error,we=t.Function,ke=t.Math,Se=t.Object,Oe=t.RegExp,Te=t.String,Ee=t.TypeError,je=r.prototype,Ce=we.prototype,Ae=Se.prototype,Ze=t["__core-js_shared__"],Ie=Ce.toString,Re=Ae.hasOwnProperty,Ne=0,Pe=(n=/[^.]+$/.exec(Ze&&Ze.keys&&Ze.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Me=Ae.toString,$e=Ie.call(Se),ze=ft._,Be=Oe("^"+Ie.call(Re).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Le=ht?t.Buffer:i,We=t.Symbol,De=t.Uint8Array,Fe=Le?Le.allocUnsafe:i,Ue=on(Se.getPrototypeOf,Se),Ve=Se.create,Ke=Ae.propertyIsEnumerable,qe=je.splice,Ge=We?We.isConcatSpreadable:i,He=We?We.iterator:i,Ye=We?We.toStringTag:i,et=function(){try{var e=ua(Se,"defineProperty");return e({},"",{}),e}catch(e){}}(),ot=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,ct=ie&&ie.now!==ft.Date.now&&ie.now,lt=t.setTimeout!==ft.setTimeout&&t.setTimeout,dt=ke.ceil,pt=ke.floor,mt=Se.getOwnPropertySymbols,vt=Le?Le.isBuffer:i,Mt=t.isFinite,Ut=je.join,mn=on(Se.keys,Se),vn=ke.max,gn=ke.min,_n=ie.now,yn=t.parseInt,bn=ke.random,xn=je.reverse,wn=ua(t,"DataView"),kn=ua(t,"Map"),Sn=ua(t,"Promise"),On=ua(t,"Set"),Tn=ua(t,"WeakMap"),En=ua(Se,"create"),jn=Tn&&new Tn,Cn={},An=Ma(wn),Zn=Ma(kn),In=Ma(Sn),Rn=Ma(On),Nn=Ma(Tn),Pn=We?We.prototype:i,Mn=Pn?Pn.valueOf:i,$n=Pn?Pn.toString:i;function zn(e){if(es(e)&&!Fo(e)&&!(e instanceof Dn)){if(e instanceof Wn)return e;if(Re.call(e,"__wrapped__"))return $a(e)}return new Wn(e)}var Bn=function(){function e(){}return function(t){if(!Qo(t))return{};if(Ve)return Ve(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Ln(){}function Wn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Dn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=p,this.__views__=[]}function Fn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function or(e,t,n,r,a,o){var s,u=1&t,c=2&t,l=4&t;if(n&&(s=a?n(e,r,a,o):n(e)),s!==i)return s;if(!Qo(e))return e;var f=Fo(e);if(f){if(s=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Re.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!u)return Ti(e,s)}else{var d=fa(e),p=d==b||d==x;if(qo(e))return bi(e,u);if(d==S||d==m||p&&!a){if(s=c||p?{}:pa(e),!u)return c?function(e,t){return Ei(e,la(e),t)}(e,function(e,t){return e&&Ei(t,Zs(t),e)}(s,e)):function(e,t){return Ei(e,ca(e),t)}(e,nr(s,e))}else{if(!at[d])return a?e:{};s=function(e,t,n){var r,i=e.constructor;switch(t){case Z:return xi(e);case g:case _:return new i(+e);case I:return function(e,t){var n=t?xi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case R:case N:case P:case M:case $:case z:case B:case L:case W:return wi(e,n);case w:return new i;case k:case j:return new i(e);case T:return function(e){var t=new e.constructor(e.source,de.exec(e));return t.lastIndex=e.lastIndex,t}(e);case E:return new i;case C:return r=e,Mn?Se(Mn.call(r)):{}}}(e,d,u)}}o||(o=new qn);var h=o.get(e);if(h)return h;o.set(e,s),as(e)?e.forEach((function(r){s.add(or(r,t,n,r,e,o))})):ts(e)&&e.forEach((function(r,i){s.set(i,or(r,t,n,i,e,o))}));var v=f?i:(l?c?ta:ea:c?Zs:As)(e);return Ot(v||e,(function(r,i){v&&(r=e[i=r]),Qn(s,i,or(r,t,n,i,e,o))})),s}function sr(e,t,n){var r=n.length;if(null==e)return!r;for(e=Se(e);r--;){var a=n[r],o=t[a],s=e[a];if(s===i&&!(a in e)||!o(s))return!1}return!0}function ur(e,t,n){if("function"!=typeof e)throw new Ee(a);return Ea((function(){e.apply(i,n)}),t)}function cr(e,t,n,r){var i=-1,a=Ct,o=!0,s=e.length,u=[],c=t.length;if(!s)return u;n&&(t=Zt(t,Ht(n))),r?(a=At,o=!1):t.length>=200&&(a=Jt,o=!1,t=new Kn(t));e:for(;++i-1},Un.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Vn.prototype.clear=function(){this.size=0,this.__data__={hash:new Fn,map:new(kn||Un),string:new Fn}},Vn.prototype.delete=function(e){var t=oa(this,e).delete(e);return this.size-=t?1:0,t},Vn.prototype.get=function(e){return oa(this,e).get(e)},Vn.prototype.has=function(e){return oa(this,e).has(e)},Vn.prototype.set=function(e,t){var n=oa(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Kn.prototype.add=Kn.prototype.push=function(e){return this.__data__.set(e,o),this},Kn.prototype.has=function(e){return this.__data__.has(e)},qn.prototype.clear=function(){this.__data__=new Un,this.size=0},qn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},qn.prototype.get=function(e){return this.__data__.get(e)},qn.prototype.has=function(e){return this.__data__.has(e)},qn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Un){var r=n.__data__;if(!kn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Vn(r)}return n.set(e,t),this.size=n.size,this};var lr=Ai(_r),fr=Ai(yr,!0);function dr(e,t){var n=!0;return lr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function pr(e,t,n){for(var r=-1,a=e.length;++r0&&n(s)?t>1?mr(s,t-1,n,r,i):It(i,s):r||(i[i.length]=s)}return i}var vr=Zi(),gr=Zi(!0);function _r(e,t){return e&&vr(e,t,As)}function yr(e,t){return e&&gr(e,t,As)}function br(e,t){return jt(t,(function(t){return Xo(e[t])}))}function xr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Or(e,t){return null!=e&&Re.call(e,t)}function Tr(e,t){return null!=e&&t in Se(e)}function Er(e,t,n){for(var a=n?At:Ct,o=e[0].length,s=e.length,u=s,c=r(s),l=1/0,f=[];u--;){var d=e[u];u&&t&&(d=Zt(d,Ht(t))),l=gn(d.length,l),c[u]=!n&&(t||o>=120&&d.length>=120)?new Kn(u&&d):i}d=e[0];var p=-1,h=c[0];e:for(;++p=s?u:u*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Dr(e,t,n){for(var r=-1,i=t.length,a={};++r-1;)s!==e&&qe.call(s,u,1),qe.call(e,u,1);return e}function Ur(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==a){var a=i;ma(i)?qe.call(e,i,1):ui(e,i)}}return e}function Vr(e,t){return e+pt(bn()*(t-e+1))}function Kr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=pt(t/2))&&(e+=e)}while(t);return n}function qr(e,t){return ja(ka(e,t,nu),e+"")}function Gr(e){return Hn(Bs(e))}function Hr(e,t){var n=Bs(e);return Za(n,ar(t,0,n.length))}function Xr(e,t,n,r){if(!Qo(e))return e;for(var a=-1,o=(t=vi(t,e)).length,s=o-1,u=e;null!=u&&++aa?0:a+t),(n=n>a?a:n)<0&&(n+=a),a=t>n?0:n-t>>>0,t>>>=0;for(var o=r(a);++i>>1,o=e[a];null!==o&&!ss(o)&&(n?o<=t:o=200){var c=t?null:Ki(e);if(c)return un(c);o=!1,i=Jt,u=new Kn}else u=t?[]:s;e:for(;++r=r?e:ei(e,t,n)}var yi=ot||function(e){return ft.clearTimeout(e)};function bi(e,t){if(t)return e.slice();var n=e.length,r=Fe?Fe(n):new e.constructor(n);return e.copy(r),r}function xi(e){var t=new e.constructor(e.byteLength);return new De(t).set(new De(e)),t}function wi(e,t){var n=t?xi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ki(e,t){if(e!==t){var n=e!==i,r=null===e,a=e==e,o=ss(e),s=t!==i,u=null===t,c=t==t,l=ss(t);if(!u&&!l&&!o&&e>t||o&&s&&c&&!u&&!l||r&&s&&c||!n&&c||!a)return 1;if(!r&&!o&&!l&&e1?n[a-1]:i,s=a>2?n[2]:i;for(o=e.length>3&&"function"==typeof o?(a--,o):i,s&&va(n[0],n[1],s)&&(o=a<3?i:o,a=1),t=Se(t);++r-1?a[o?t[s]:s]:i}}function Mi(e){return Qi((function(t){var n=t.length,r=n,o=Wn.prototype.thru;for(e&&t.reverse();r--;){var s=t[r];if("function"!=typeof s)throw new Ee(a);if(o&&!u&&"wrapper"==ra(s))var u=new Wn([],!0)}for(r=u?r:n;++r1&&b.reverse(),p&&fu))return!1;var l=o.get(e),f=o.get(t);if(l&&f)return l==t&&f==e;var d=-1,p=!0,h=2&n?new Kn:i;for(o.set(e,t),o.set(t,e);++d-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(ae,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return Ot(h,(function(n){var r="_."+n[0];t&n[1]&&!Ct(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(oe);return t?t[1].split(se):[]}(r),n)))}function Aa(e){var t=0,n=0;return function(){var r=_n(),a=16-(r-n);if(n=r,a>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function Za(e,t){var n=-1,r=e.length,a=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ro(e,n)}));function lo(e){var t=zn(e);return t.__chain__=!0,t}function fo(e,t){return t(e)}var po=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,a=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Dn&&ma(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:fo,args:[a],thisArg:i}),new Wn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(a)})),ho=ji((function(e,t,n){Re.call(e,n)?++e[n]:rr(e,n,1)})),mo=Pi(Wa),vo=Pi(Da);function go(e,t){return(Fo(e)?Ot:lr)(e,aa(t,3))}function _o(e,t){return(Fo(e)?Tt:fr)(e,aa(t,3))}var yo=ji((function(e,t,n){Re.call(e,n)?e[n].push(t):rr(e,n,[t])})),bo=qr((function(e,t,n){var i=-1,a="function"==typeof t,o=Vo(e)?r(e.length):[];return lr(e,(function(e){o[++i]=a?kt(t,e,n):jr(e,t,n)})),o})),xo=ji((function(e,t,n){rr(e,n,t)}));function wo(e,t){return(Fo(e)?Zt:Mr)(e,aa(t,3))}var ko=ji((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),So=qr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&va(e,t[0],t[1])?t=[]:n>2&&va(t[0],t[1],t[2])&&(t=[t[0]]),Wr(e,mr(t,1),[])})),Oo=ct||function(){return ft.Date.now()};function To(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,Gi(e,c,i,i,i,i,t)}function Eo(e,t){var n;if("function"!=typeof t)throw new Ee(a);return e=ps(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var jo=qr((function(e,t,n){var r=1;if(n.length){var i=sn(n,ia(jo));r|=u}return Gi(e,r,t,n,i)})),Co=qr((function(e,t,n){var r=3;if(n.length){var i=sn(n,ia(Co));r|=u}return Gi(t,r,e,n,i)}));function Ao(e,t,n){var r,o,s,u,c,l,f=0,d=!1,p=!1,h=!0;if("function"!=typeof e)throw new Ee(a);function m(t){var n=r,a=o;return r=o=i,f=t,u=e.apply(a,n)}function v(e){var n=e-l;return l===i||n>=t||n<0||p&&e-f>=s}function g(){var e=Oo();if(v(e))return _(e);c=Ea(g,function(e){var n=t-(e-l);return p?gn(n,s-(e-f)):n}(e))}function _(e){return c=i,h&&r?m(e):(r=o=i,u)}function y(){var e=Oo(),n=v(e);if(r=arguments,o=this,l=e,n){if(c===i)return function(e){return f=e,c=Ea(g,t),d?m(e):u}(l);if(p)return yi(c),c=Ea(g,t),m(l)}return c===i&&(c=Ea(g,t)),u}return t=ms(t)||0,Qo(n)&&(d=!!n.leading,s=(p="maxWait"in n)?vn(ms(n.maxWait)||0,t):s,h="trailing"in n?!!n.trailing:h),y.cancel=function(){c!==i&&yi(c),f=0,r=l=o=c=i},y.flush=function(){return c===i?u:_(Oo())},y}var Zo=qr((function(e,t){return ur(e,1,t)})),Io=qr((function(e,t,n){return ur(e,ms(t)||0,n)}));function Ro(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Ee(a);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(Ro.Cache||Vn),n}function No(e){if("function"!=typeof e)throw new Ee(a);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Ro.Cache=Vn;var Po=gi((function(e,t){var n=(t=1==t.length&&Fo(t[0])?Zt(t[0],Ht(aa())):Zt(mr(t,1),Ht(aa()))).length;return qr((function(r){for(var i=-1,a=gn(r.length,n);++i=t})),Do=Cr(function(){return arguments}())?Cr:function(e){return es(e)&&Re.call(e,"callee")&&!Ke.call(e,"callee")},Fo=r.isArray,Uo=gt?Ht(gt):function(e){return es(e)&&kr(e)==Z};function Vo(e){return null!=e&&Yo(e.length)&&!Xo(e)}function Ko(e){return es(e)&&Vo(e)}var qo=vt||mu,Go=_t?Ht(_t):function(e){return es(e)&&kr(e)==_};function Ho(e){if(!es(e))return!1;var t=kr(e);return t==y||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!rs(e)}function Xo(e){if(!Qo(e))return!1;var t=kr(e);return t==b||t==x||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Jo(e){return"number"==typeof e&&e==ps(e)}function Yo(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qo(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function es(e){return null!=e&&"object"==typeof e}var ts=yt?Ht(yt):function(e){return es(e)&&fa(e)==w};function ns(e){return"number"==typeof e||es(e)&&kr(e)==k}function rs(e){if(!es(e)||kr(e)!=S)return!1;var t=Ue(e);if(null===t)return!0;var n=Re.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Ie.call(n)==$e}var is=bt?Ht(bt):function(e){return es(e)&&kr(e)==T},as=xt?Ht(xt):function(e){return es(e)&&fa(e)==E};function os(e){return"string"==typeof e||!Fo(e)&&es(e)&&kr(e)==j}function ss(e){return"symbol"==typeof e||es(e)&&kr(e)==C}var us=wt?Ht(wt):function(e){return es(e)&&Yo(e.length)&&!!it[kr(e)]},cs=Fi(Pr),ls=Fi((function(e,t){return e<=t}));function fs(e){if(!e)return[];if(Vo(e))return os(e)?fn(e):Ti(e);if(He&&e[He])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[He]());var t=fa(e);return(t==w?an:t==E?un:Bs)(e)}function ds(e){return e?(e=ms(e))===l||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function ps(e){var t=ds(e),n=t%1;return t==t?n?t-n:t:0}function hs(e){return e?ar(ps(e),0,p):0}function ms(e){if("number"==typeof e)return e;if(ss(e))return d;if(Qo(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qo(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Gt(e);var n=he.test(e);return n||ve.test(e)?ut(e.slice(2),n?2:8):pe.test(e)?d:+e}function vs(e){return Ei(e,Zs(e))}function gs(e){return null==e?"":oi(e)}var _s=Ci((function(e,t){if(ba(t)||Vo(t))Ei(t,As(t),e);else for(var n in t)Re.call(t,n)&&Qn(e,n,t[n])})),ys=Ci((function(e,t){Ei(t,Zs(t),e)})),bs=Ci((function(e,t,n,r){Ei(t,Zs(t),e,r)})),xs=Ci((function(e,t,n,r){Ei(t,As(t),e,r)})),ws=Qi(ir),ks=qr((function(e,t){e=Se(e);var n=-1,r=t.length,a=r>2?t[2]:i;for(a&&va(t[0],t[1],a)&&(r=1);++n1),t})),Ei(e,ta(e),n),r&&(n=or(n,7,Ji));for(var i=t.length;i--;)ui(n,t[i]);return n})),Ps=Qi((function(e,t){return null==e?{}:function(e,t){return Dr(e,t,(function(t,n){return Ts(e,n)}))}(e,t)}));function Ms(e,t){if(null==e)return{};var n=Zt(ta(e),(function(e){return[e]}));return t=aa(t),Dr(e,n,(function(e,n){return t(e,n[0])}))}var $s=qi(As),zs=qi(Zs);function Bs(e){return null==e?[]:Xt(e,As(e))}var Ls=Ri((function(e,t,n){return t=t.toLowerCase(),e+(n?Ws(t):t)}));function Ws(e){return Hs(gs(e).toLowerCase())}function Ds(e){return(e=gs(e))&&e.replace(_e,en).replace(Je,"")}var Fs=Ri((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),Us=Ri((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Vs=Ii("toLowerCase"),Ks=Ri((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),qs=Ri((function(e,t,n){return e+(n?" ":"")+Hs(t)})),Gs=Ri((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Hs=Ii("toUpperCase");function Xs(e,t,n){return e=gs(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(ue)||[]}(e):e.match(t)||[]}var Js=qr((function(e,t){try{return kt(e,i,t)}catch(e){return Ho(e)?e:new xe(e)}})),Ys=Qi((function(e,t){return Ot(t,(function(t){t=Pa(t),rr(e,t,jo(e[t],e))})),e}));function Qs(e){return function(){return e}}var eu=Mi(),tu=Mi(!0);function nu(e){return e}function ru(e){return Rr("function"==typeof e?e:or(e,1))}var iu=qr((function(e,t){return function(n){return jr(n,e,t)}})),au=qr((function(e,t){return function(n){return jr(e,n,t)}}));function ou(e,t,n){var r=As(t),i=br(t,r);null!=n||Qo(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=br(t,As(t)));var a=!(Qo(n)&&"chain"in n&&!n.chain),o=Xo(e);return Ot(i,(function(n){var r=t[n];e[n]=r,o&&(e.prototype[n]=function(){var t=this.__chain__;if(a||t){var n=e(this.__wrapped__);return(n.__actions__=Ti(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,It([this.value()],arguments))})})),e}function su(){}var uu=Li(Zt),cu=Li(Et),lu=Li(Pt);function fu(e){return ga(e)?Ft(Pa(e)):function(e){return function(t){return xr(t,e)}}(e)}var du=Di(),pu=Di(!0);function hu(){return[]}function mu(){return!1}var vu,gu=Bi((function(e,t){return e+t}),0),_u=Vi("ceil"),yu=Bi((function(e,t){return e/t}),1),bu=Vi("floor"),xu=Bi((function(e,t){return e*t}),1),wu=Vi("round"),ku=Bi((function(e,t){return e-t}),0);return zn.after=function(e,t){if("function"!=typeof t)throw new Ee(a);return e=ps(e),function(){if(--e<1)return t.apply(this,arguments)}},zn.ary=To,zn.assign=_s,zn.assignIn=ys,zn.assignInWith=bs,zn.assignWith=xs,zn.at=ws,zn.before=Eo,zn.bind=jo,zn.bindAll=Ys,zn.bindKey=Co,zn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Fo(e)?e:[e]},zn.chain=lo,zn.chunk=function(e,t,n){t=(n?va(e,t,n):t===i)?1:vn(ps(t),0);var a=null==e?0:e.length;if(!a||t<1)return[];for(var o=0,s=0,u=r(dt(a/t));oa?0:a+n),(r=r===i||r>a?a:ps(r))<0&&(r+=a),r=n>r?0:hs(r);n>>0)?(e=gs(e))&&("string"==typeof t||null!=t&&!is(t))&&!(t=oi(t))&&rn(e)?_i(fn(e),0,n):e.split(t,n):[]},zn.spread=function(e,t){if("function"!=typeof e)throw new Ee(a);return t=null==t?0:vn(ps(t),0),qr((function(n){var r=n[t],i=_i(n,0,t);return r&&It(i,r),kt(e,this,i)}))},zn.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},zn.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:ps(t))<0?0:t):[]},zn.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:ps(t)))<0?0:t,r):[]},zn.takeRightWhile=function(e,t){return e&&e.length?li(e,aa(t,3),!1,!0):[]},zn.takeWhile=function(e,t){return e&&e.length?li(e,aa(t,3)):[]},zn.tap=function(e,t){return t(e),e},zn.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new Ee(a);return Qo(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ao(e,t,{leading:r,maxWait:t,trailing:i})},zn.thru=fo,zn.toArray=fs,zn.toPairs=$s,zn.toPairsIn=zs,zn.toPath=function(e){return Fo(e)?Zt(e,Pa):ss(e)?[e]:Ti(Na(gs(e)))},zn.toPlainObject=vs,zn.transform=function(e,t,n){var r=Fo(e),i=r||qo(e)||us(e);if(t=aa(t,4),null==n){var a=e&&e.constructor;n=i?r?new a:[]:Qo(e)&&Xo(a)?Bn(Ue(e)):{}}return(i?Ot:_r)(e,(function(e,r,i){return t(n,e,r,i)})),n},zn.unary=function(e){return To(e,1)},zn.union=Qa,zn.unionBy=eo,zn.unionWith=to,zn.uniq=function(e){return e&&e.length?si(e):[]},zn.uniqBy=function(e,t){return e&&e.length?si(e,aa(t,2)):[]},zn.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?si(e,i,t):[]},zn.unset=function(e,t){return null==e||ui(e,t)},zn.unzip=no,zn.unzipWith=ro,zn.update=function(e,t,n){return null==e?e:ci(e,t,mi(n))},zn.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:ci(e,t,mi(n),r)},zn.values=Bs,zn.valuesIn=function(e){return null==e?[]:Xt(e,Zs(e))},zn.without=io,zn.words=Xs,zn.wrap=function(e,t){return Mo(mi(t),e)},zn.xor=ao,zn.xorBy=oo,zn.xorWith=so,zn.zip=uo,zn.zipObject=function(e,t){return pi(e||[],t||[],Qn)},zn.zipObjectDeep=function(e,t){return pi(e||[],t||[],Xr)},zn.zipWith=co,zn.entries=$s,zn.entriesIn=zs,zn.extend=ys,zn.extendWith=bs,ou(zn,zn),zn.add=gu,zn.attempt=Js,zn.camelCase=Ls,zn.capitalize=Ws,zn.ceil=_u,zn.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=ms(n))==n?n:0),t!==i&&(t=(t=ms(t))==t?t:0),ar(ms(e),t,n)},zn.clone=function(e){return or(e,4)},zn.cloneDeep=function(e){return or(e,5)},zn.cloneDeepWith=function(e,t){return or(e,5,t="function"==typeof t?t:i)},zn.cloneWith=function(e,t){return or(e,4,t="function"==typeof t?t:i)},zn.conformsTo=function(e,t){return null==t||sr(e,t,As(t))},zn.deburr=Ds,zn.defaultTo=function(e,t){return null==e||e!=e?t:e},zn.divide=yu,zn.endsWith=function(e,t,n){e=gs(e),t=oi(t);var r=e.length,a=n=n===i?r:ar(ps(n),0,r);return(n-=t.length)>=0&&e.slice(n,a)==t},zn.eq=Bo,zn.escape=function(e){return(e=gs(e))&&G.test(e)?e.replace(K,tn):e},zn.escapeRegExp=function(e){return(e=gs(e))&&ne.test(e)?e.replace(te,"\\$&"):e},zn.every=function(e,t,n){var r=Fo(e)?Et:dr;return n&&va(e,t,n)&&(t=i),r(e,aa(t,3))},zn.find=mo,zn.findIndex=Wa,zn.findKey=function(e,t){return $t(e,aa(t,3),_r)},zn.findLast=vo,zn.findLastIndex=Da,zn.findLastKey=function(e,t){return $t(e,aa(t,3),yr)},zn.floor=bu,zn.forEach=go,zn.forEachRight=_o,zn.forIn=function(e,t){return null==e?e:vr(e,aa(t,3),Zs)},zn.forInRight=function(e,t){return null==e?e:gr(e,aa(t,3),Zs)},zn.forOwn=function(e,t){return e&&_r(e,aa(t,3))},zn.forOwnRight=function(e,t){return e&&yr(e,aa(t,3))},zn.get=Os,zn.gt=Lo,zn.gte=Wo,zn.has=function(e,t){return null!=e&&da(e,t,Or)},zn.hasIn=Ts,zn.head=Ua,zn.identity=nu,zn.includes=function(e,t,n,r){e=Vo(e)?e:Bs(e),n=n&&!r?ps(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),os(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&Bt(e,t,n)>-1},zn.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:ps(n);return i<0&&(i=vn(r+i,0)),Bt(e,t,i)},zn.inRange=function(e,t,n){return t=ds(t),n===i?(n=t,t=0):n=ds(n),function(e,t,n){return e>=gn(t,n)&&e=-9007199254740991&&e<=f},zn.isSet=as,zn.isString=os,zn.isSymbol=ss,zn.isTypedArray=us,zn.isUndefined=function(e){return e===i},zn.isWeakMap=function(e){return es(e)&&fa(e)==A},zn.isWeakSet=function(e){return es(e)&&"[object WeakSet]"==kr(e)},zn.join=function(e,t){return null==e?"":Ut.call(e,t)},zn.kebabCase=Fs,zn.last=Ga,zn.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var a=r;return n!==i&&(a=(a=ps(n))<0?vn(r+a,0):gn(a,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,a):zt(e,Wt,a,!0)},zn.lowerCase=Us,zn.lowerFirst=Vs,zn.lt=cs,zn.lte=ls,zn.max=function(e){return e&&e.length?pr(e,nu,Sr):i},zn.maxBy=function(e,t){return e&&e.length?pr(e,aa(t,2),Sr):i},zn.mean=function(e){return Dt(e,nu)},zn.meanBy=function(e,t){return Dt(e,aa(t,2))},zn.min=function(e){return e&&e.length?pr(e,nu,Pr):i},zn.minBy=function(e,t){return e&&e.length?pr(e,aa(t,2),Pr):i},zn.stubArray=hu,zn.stubFalse=mu,zn.stubObject=function(){return{}},zn.stubString=function(){return""},zn.stubTrue=function(){return!0},zn.multiply=xu,zn.nth=function(e,t){return e&&e.length?Lr(e,ps(t)):i},zn.noConflict=function(){return ft._===this&&(ft._=ze),this},zn.noop=su,zn.now=Oo,zn.pad=function(e,t,n){e=gs(e);var r=(t=ps(t))?ln(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Wi(pt(i),n)+e+Wi(dt(i),n)},zn.padEnd=function(e,t,n){e=gs(e);var r=(t=ps(t))?ln(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var a=bn();return gn(e+a*(t-e+st("1e-"+((a+"").length-1))),t)}return Vr(e,t)},zn.reduce=function(e,t,n){var r=Fo(e)?Rt:Vt,i=arguments.length<3;return r(e,aa(t,4),n,i,lr)},zn.reduceRight=function(e,t,n){var r=Fo(e)?Nt:Vt,i=arguments.length<3;return r(e,aa(t,4),n,i,fr)},zn.repeat=function(e,t,n){return t=(n?va(e,t,n):t===i)?1:ps(t),Kr(gs(e),t)},zn.replace=function(){var e=arguments,t=gs(e[0]);return e.length<3?t:t.replace(e[1],e[2])},zn.result=function(e,t,n){var r=-1,a=(t=vi(t,e)).length;for(a||(a=1,e=i);++rf)return[];var n=p,r=gn(e,p);t=aa(t),e-=p;for(var i=qt(r,t);++n=o)return e;var u=n-ln(r);if(u<1)return r;var c=s?_i(s,0,u).join(""):e.slice(0,u);if(a===i)return c+r;if(s&&(u+=c.length-u),is(a)){if(e.slice(u).search(a)){var l,f=c;for(a.global||(a=Oe(a.source,gs(de.exec(a))+"g")),a.lastIndex=0;l=a.exec(f);)var d=l.index;c=c.slice(0,d===i?u:d)}}else if(e.indexOf(oi(a),u)!=u){var p=c.lastIndexOf(a);p>-1&&(c=c.slice(0,p))}return c+r},zn.unescape=function(e){return(e=gs(e))&&q.test(e)?e.replace(V,pn):e},zn.uniqueId=function(e){var t=++Ne;return gs(e)+t},zn.upperCase=Gs,zn.upperFirst=Hs,zn.each=go,zn.eachRight=_o,zn.first=Ua,ou(zn,(vu={},_r(zn,(function(e,t){Re.call(zn.prototype,t)||(vu[t]=e)})),vu),{chain:!1}),zn.VERSION="4.17.21",Ot(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){zn[e].placeholder=zn})),Ot(["drop","take"],(function(e,t){Dn.prototype[e]=function(n){n=n===i?1:vn(ps(n),0);var r=this.__filtered__&&!t?new Dn(this):this.clone();return r.__filtered__?r.__takeCount__=gn(n,r.__takeCount__):r.__views__.push({size:gn(n,p),type:e+(r.__dir__<0?"Right":"")}),r},Dn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),Ot(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Dn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:aa(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),Ot(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Dn.prototype[e]=function(){return this[n](1).value()[0]}})),Ot(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Dn.prototype[e]=function(){return this.__filtered__?new Dn(this):this[n](1)}})),Dn.prototype.compact=function(){return this.filter(nu)},Dn.prototype.find=function(e){return this.filter(e).head()},Dn.prototype.findLast=function(e){return this.reverse().find(e)},Dn.prototype.invokeMap=qr((function(e,t){return"function"==typeof e?new Dn(this):this.map((function(n){return jr(n,e,t)}))})),Dn.prototype.reject=function(e){return this.filter(No(aa(e)))},Dn.prototype.slice=function(e,t){e=ps(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Dn(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=ps(t))<0?n.dropRight(-t):n.take(t-e)),n)},Dn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Dn.prototype.toArray=function(){return this.take(p)},_r(Dn.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),a=zn[r?"take"+("last"==t?"Right":""):t],o=r||/^find/.test(t);a&&(zn.prototype[t]=function(){var t=this.__wrapped__,s=r?[1]:arguments,u=t instanceof Dn,c=s[0],l=u||Fo(t),f=function(e){var t=a.apply(zn,It([e],s));return r&&d?t[0]:t};l&&n&&"function"==typeof c&&1!=c.length&&(u=l=!1);var d=this.__chain__,p=!!this.__actions__.length,h=o&&!d,m=u&&!p;if(!o&&l){t=m?t:new Dn(this);var v=e.apply(t,s);return v.__actions__.push({func:fo,args:[f],thisArg:i}),new Wn(v,d)}return h&&m?e.apply(this,s):(v=this.thru(f),h?r?v.value()[0]:v.value():v)})})),Ot(["pop","push","shift","sort","splice","unshift"],(function(e){var t=je[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);zn.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Fo(i)?i:[],e)}return this[n]((function(n){return t.apply(Fo(n)?n:[],e)}))}})),_r(Dn.prototype,(function(e,t){var n=zn[t];if(n){var r=n.name+"";Re.call(Cn,r)||(Cn[r]=[]),Cn[r].push({name:t,func:n})}})),Cn[$i(i,2).name]=[{name:"wrapper",func:i}],Dn.prototype.clone=function(){var e=new Dn(this.__wrapped__);return e.__actions__=Ti(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ti(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ti(this.__views__),e},Dn.prototype.reverse=function(){if(this.__filtered__){var e=new Dn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Dn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Fo(e),r=t<0,i=n?e.length:0,a=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},zn.prototype.plant=function(e){for(var t,n=this;n instanceof Ln;){var r=$a(n);r.__index__=0,r.__values__=i,t?a.__wrapped__=r:t=r;var a=r;n=n.__wrapped__}return a.__wrapped__=e,t},zn.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Dn){var t=e;return this.__actions__.length&&(t=new Dn(this)),(t=t.reverse()).__actions__.push({func:fo,args:[Ya],thisArg:i}),new Wn(t,this.__chain__)}return this.thru(Ya)},zn.prototype.toJSON=zn.prototype.valueOf=zn.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},zn.prototype.first=zn.prototype.head,He&&(zn.prototype[He]=function(){return this}),zn}();ft._=hn,(r=function(){return hn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},a=i[typeof window]&&window||this,o=i[typeof t]&&t,s=i.object&&e&&!e.nodeType&&e,u=o&&s&&"object"==typeof n.g&&n.g;!u||u.global!==u&&u.window!==u&&u.self!==u||(a=u);var c=Math.pow(2,53)-1,l=/\bOpera/,f=Object.prototype,d=f.hasOwnProperty,p=f.toString;function h(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function m(e){return e=b(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:h(e)}function v(e,t){for(var n in e)d.call(e,n)&&t(e[n],n,e)}function g(e){return null==e?h(e):p.call(e).slice(8,-1)}function _(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function y(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=c)for(;++n3?"WebKit":/\bOpera\b/.test(B)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(z)&&"WebKit"||!z&&/\bMSIE\b/i.test(t)&&("Mac OS"==D?"Tasman":"Trident")||"WebKit"==z&&/\bPlayStation\b(?! Vita\b)/i.test(B)&&"NetFront")&&(z=[s]),"IE"==B&&(s=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(B+=" Mobile",D="Windows Phone "+(/\+$/.test(s)?s:s+".x"),N.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(B="IE Mobile",D="Windows Phone 8.x",N.unshift("desktop mode"),$||($=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=B&&"Trident"==z&&(s=/\brv:([\d.]+)/.exec(t))&&(B&&N.push("identifying as "+B+($?" "+$:"")),B="IE",$=s[1]),M){if(f="global",d=null!=(c=n)?typeof c[f]:"number",/^(?:boolean|number|string|undefined)$/.test(d)||"object"==d&&!c[f])g(s=n.runtime)==w?(B="Adobe AIR",D=s.flash.system.Capabilities.os):g(s=n.phantom)==O?(B="PhantomJS",$=(s=s.version||null)&&s.major+"."+s.minor+"."+s.patch):"number"==typeof A.documentMode&&(s=/\bTrident\/(\d+)/i.exec(t))?($=[$,A.documentMode],(s=+s[1]+4)!=$[1]&&(N.push("IE "+$[1]+" mode"),z&&(z[1]=""),$[1]=s),$="IE"==B?String($[1].toFixed(1)):$[0]):"number"==typeof A.documentMode&&/^(?:Chrome|Firefox)\b/.test(B)&&(N.push("masking as "+B+" "+$),B="IE",$="11.0",z=["Trident"],D="Windows");else if(T&&(R=(s=T.lang.System).getProperty("os.arch"),D=D||s.getProperty("os.name")+" "+s.getProperty("os.version")),E){try{$=n.require("ringo/engine").version.join("."),B="RingoJS"}catch(e){(s=n.system)&&s.global.system==n.system&&(B="Narwhal",D||(D=s[0].os||null))}B||(B="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(s=n.process)&&("object"==typeof s.versions&&("string"==typeof s.versions.electron?(N.push("Node "+s.versions.node),B="Electron",$=s.versions.electron):"string"==typeof s.versions.nw&&(N.push("Chromium "+$,"Node "+s.versions.node),B="NW.js",$=s.versions.nw)),B||(B="Node.js",R=s.arch,D=s.platform,$=($=/[\d.]+/.exec(s.version))?$[0]:null));D=D&&m(D)}if($&&(s=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec($)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(M&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(P=/b/i.test(s)?"beta":"alpha",$=$.replace(RegExp(s+"\\+?$"),"")+("beta"==P?C:j)+(/\d+\+?/.exec(s)||"")),"Fennec"==B||"Firefox"==B&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(D))B="Firefox Mobile";else if("Maxthon"==B&&$)$=$.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(L))"Xbox 360"==L&&(D=null),"Xbox 360"==L&&/\bIEMobile\b/.test(t)&&N.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(B)&&(!B||L||/Browser|Mobi/.test(B))||"Windows CE"!=D&&!/Mobi/i.test(t))if("IE"==B&&M)try{null===n.external&&N.unshift("platform preview")}catch(e){N.unshift("embedded")}else(/\bBlackBerry\b/.test(L)||/\bBB10\b/.test(t))&&(s=(RegExp(L.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||$)?(D=((s=[s,/BB10/.test(t)])[1]?(L=null,W="BlackBerry"):"Device Software")+" "+s[0],$=null):this!=v&&"Wii"!=L&&(M&&Z||/Opera/.test(B)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==B&&/\bOS X (?:\d+\.){2,}/.test(D)||"IE"==B&&(D&&!/^Win/.test(D)&&$>5.5||/\bWindows XP\b/.test(D)&&$>8||8==$&&!/\bTrident\b/.test(t)))&&!l.test(s=e.call(v,t.replace(l,"")+";"))&&s.name&&(s="ing as "+s.name+((s=s.version)?" "+s:""),l.test(B)?(/\bIE\b/.test(s)&&"Mac OS"==D&&(D=null),s="identify"+s):(s="mask"+s,B=I?m(I.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(s)&&(D=null),M||($=null)),z=["Presto"],N.push(s));else B+=" Mobile";(s=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(s=[parseFloat(s.replace(/\.(\d)$/,".0$1")),s],"Safari"==B&&"+"==s[1].slice(-1)?(B="WebKit Nightly",P="alpha",$=s[1].slice(0,-1)):$!=s[1]&&$!=(s[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||($=null),s[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==s[0]&&537.36==s[2]&&parseFloat(s[1])>=28&&"WebKit"==z&&(z=["Blink"]),M&&(h||s[1])?(z&&(z[1]="like Chrome"),s=s[1]||((s=s[0])<530?1:s<532?2:s<532.05?3:s<533?4:s<534.03?5:s<534.07?6:s<534.1?7:s<534.13?8:s<534.16?9:s<534.24?10:s<534.3?11:s<535.01?12:s<535.02?"13+":s<535.07?15:s<535.11?16:s<535.19?17:s<536.05?18:s<536.1?19:s<537.01?20:s<537.11?"21+":s<537.13?23:s<537.18?24:s<537.24?25:s<537.36?26:"Blink"!=z?"27":"28")):(z&&(z[1]="like Safari"),s=(s=s[0])<400?1:s<500?2:s<526?3:s<533?4:s<534?"4+":s<535?5:s<537?6:s<538?7:s<601?8:s<602?9:s<604?10:s<606?11:s<608?12:"12"),z&&(z[1]+=" "+(s+="number"==typeof s?".x":/[.+]/.test(s)?"":"+")),"Safari"==B&&(!$||parseInt($)>45)?$=s:"Chrome"==B&&/\bHeadlessChrome/i.test(t)&&N.unshift("headless")),"Opera"==B&&(s=/\bzbov|zvav$/.exec(D))?(B+=" ",N.unshift("desktop mode"),"zvav"==s?(B+="Mini",$=null):B+="Mobile",D=D.replace(RegExp(" *"+s+"$"),"")):"Safari"==B&&/\bChrome\b/.exec(z&&z[1])?(N.unshift("desktop mode"),B="Chrome Mobile",$=null,/\bOS X\b/.test(D)?(W="Apple",D="iOS 4.3+"):D=null):/\bSRWare Iron\b/.test(B)&&!$&&($=U("Chrome")),$&&0==$.indexOf(s=/[\d.]+$/.exec(D))&&t.indexOf("/"+s+"-")>-1&&(D=b(D.replace(s,""))),D&&-1!=D.indexOf(B)&&!RegExp(B+" OS").test(D)&&(D=D.replace(RegExp(" *"+_(B)+" *"),"")),z&&!/\b(?:Avant|Nook)\b/.test(B)&&(/Browser|Lunascape|Maxthon/.test(B)||"Safari"!=B&&/^iOS/.test(D)&&/\bSafari\b/.test(z[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(B)&&z[1])&&(s=z[z.length-1])&&N.push(s),N.length&&(N=["("+N.join("; ")+")"]),W&&L&&L.indexOf(W)<0&&N.push("on "+W),L&&N.push((/^on /.test(N[N.length-1])?"":"on ")+L),D&&(s=/ ([\d.+]+)$/.exec(D),u=s&&"/"==D.charAt(D.length-s[0].length-1),D={architecture:32,family:s&&!u?D.replace(s[0],""):D,version:s?s[1]:null,toString:function(){var e=this.version;return this.family+(e&&!u?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(s=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(R))&&!/\bi686\b/i.test(R)?(D&&(D.architecture=64,D.family=D.family.replace(RegExp(" *"+s),"")),B&&(/\bWOW64\b/i.test(t)||M&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&N.unshift("32-bit")):D&&/^OS X/.test(D.family)&&"Chrome"==B&&parseFloat($)>=39&&(D.architecture=64),t||(t=null);var V={};return V.description=t,V.layout=z&&z[0],V.manufacturer=W,V.name=B,V.prerelease=P,V.product=L,V.ua=t,V.version=B&&$,V.os=D||{architecture:null,family:null,version:null,toString:function(){return"null"}},V.parse=e,V.toString=function(){return this.description||""},V.version&&N.unshift($),V.name&&N.unshift(B),D&&B&&(D!=String(D).split(" ")[0]||D!=B.split(" ")[0]&&!L)&&N.push(L?"("+D+")":"on "+D),N.length&&(V.description=N.join(" ")),V}();a.platform=x,void 0===(r=function(){return x}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var a=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.loaded=!0,a.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";var e,t;n.r(r),function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},e.getValidEnumValues=t=>{const n=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),r={};for(const e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(const n of e)if(t(n))return n},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(e||(e={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(t||(t={}));const i=e.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),a=e=>{switch(typeof e){case"undefined":return i.undefined;case"string":return i.string;case"number":return isNaN(e)?i.nan:i.number;case"boolean":return i.boolean;case"function":return i.function;case"bigint":return i.bigint;case"symbol":return i.symbol;case"object":return Array.isArray(e)?i.array:null===e?i.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?i.promise:"undefined"!=typeof Map&&e instanceof Map?i.map:"undefined"!=typeof Set&&e instanceof Set?i.set:"undefined"!=typeof Date&&e instanceof Date?i.date:i.object;default:return i.unknown}},o=e.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class s extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(r);else if("invalid_return_type"===i.code)r(i.returnTypeError);else if("invalid_arguments"===i.code)r(i.argumentsError);else if(0===i.path.length)n._errors.push(t(i));else{let e=n,r=0;for(;re.message)){const t={},n=[];for(const r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}s.create=e=>new s(e);const u=(t,n)=>{let r;switch(t.code){case o.invalid_type:r=t.received===i.undefined?"Required":`Expected ${t.expected}, received ${t.received}`;break;case o.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,e.jsonStringifyReplacer)}`;break;case o.unrecognized_keys:r=`Unrecognized key(s) in object: ${e.joinValues(t.keys,", ")}`;break;case o.invalid_union:r="Invalid input";break;case o.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${e.joinValues(t.options)}`;break;case o.invalid_enum_value:r=`Invalid enum value. Expected ${e.joinValues(t.options)}, received '${t.received}'`;break;case o.invalid_arguments:r="Invalid function arguments";break;case o.invalid_return_type:r="Invalid function return type";break;case o.invalid_date:r="Invalid date";break;case o.invalid_string:"object"==typeof t.validation?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,"number"==typeof t.validation.position&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:e.assertNever(t.validation):r="regex"!==t.validation?`Invalid ${t.validation}`:"Invalid";break;case o.too_small:r="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:"number"===t.type?`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:"date"===t.type?`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:"Invalid input";break;case o.too_big:r="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:"number"===t.type?`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"bigint"===t.type?`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"date"===t.type?`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:"Invalid input";break;case o.custom:r="Invalid input";break;case o.invalid_intersection_types:r="Intersection results could not be merged";break;case o.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case o.not_finite:r="Number must be finite";break;default:r=n.defaultError,e.assertNever(t)}return{message:r}};let c=u;function l(){return c}const f=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};let s="";const u=r.filter((e=>!!e)).slice().reverse();for(const e of u)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:i.message||s}};function d(e,t){const n=f({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,l(),u].filter((e=>!!e))});e.common.issues.push(n)}class p{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const r of t){if("aborted"===r.status)return h;"dirty"===r.status&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const e of t)n.push({key:await e.key,value:await e.value});return p.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const r of t){const{key:t,value:i}=r;if("aborted"===t.status)return h;if("aborted"===i.status)return h;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"===t.value||void 0===i.value&&!r.alwaysSet||(n[t.value]=i.value)}return{status:e.value,value:n}}}const h=Object.freeze({status:"aborted"}),m=e=>({status:"dirty",value:e}),v=e=>({status:"valid",value:e}),g=e=>"aborted"===e.status,_=e=>"dirty"===e.status,y=e=>"valid"===e.status,b=e=>"undefined"!=typeof Promise&&e instanceof Promise;var x;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(x||(x={}));class w{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const k=(e,t)=>{if(y(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new s(e.common.issues);return this._error=t,this._error}}};function S(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:i}:{errorMap:(e,t)=>"invalid_type"!==e.code?{message:t.defaultError}:void 0===t.data?{message:null!=r?r:t.defaultError}:{message:null!=n?n:t.defaultError},description:i}}class O{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return a(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:a(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new p,ctx:{common:e.parent.common,data:e.data,parsedType:a(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(b(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const r={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:a(e)},i=this._parseSync({data:e,path:r.path,parent:r});return k(r,i)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:a(e)},r=this._parse({data:e,path:n.path,parent:n}),i=await(b(r)?r:Promise.resolve(r));return k(n,i)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,r)=>{const i=e(t),a=()=>r.addIssue({code:o.custom,...n(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then((e=>!!e||(a(),!1))):!!i||(a(),!1)}))}refinement(e,t){return this._refinement(((n,r)=>!!e(n)||(r.addIssue("function"==typeof t?t(n,r):t),!1)))}_refinement(e){return new de({schema:this,typeName:Se.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return pe.create(this,this._def)}nullable(){return he.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return q.create(this,this._def)}promise(){return fe.create(this,this._def)}or(e){return X.create([this,e],this._def)}and(e){return ee.create(this,e,this._def)}transform(e){return new de({...S(this._def),schema:this,typeName:Se.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new me({...S(this._def),innerType:this,defaultValue:t,typeName:Se.ZodDefault})}brand(){return new ye({typeName:Se.ZodBranded,type:this,...S(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new ve({...S(this._def),innerType:this,catchValue:t,typeName:Se.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return be.create(this,e)}readonly(){return xe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const T=/^c[^\s-]{8,}$/i,E=/^[a-z][a-z0-9]*$/,j=/^[0-9A-HJKMNP-TV-Z]{26}$/,C=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,A=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let Z;const I=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,R=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;class N extends O{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==i.string){const e=this._getOrReturnCtx(t);return d(e,{code:o.invalid_type,expected:i.string,received:e.parsedType}),h}const n=new p;let r;for(const i of this._def.checks)if("min"===i.kind)t.data.lengthi.value&&(r=this._getOrReturnCtx(t,r),d(r,{code:o.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if("length"===i.kind){const e=t.data.length>i.value,a=t.data.lengthe.test(t)),{validation:t,code:o.invalid_string,...x.errToObj(n)})}_addCheck(e){return new N({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...x.errToObj(e)})}url(e){return this._addCheck({kind:"url",...x.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...x.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...x.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...x.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...x.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...x.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...x.errToObj(e)})}datetime(e){var t;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,...x.errToObj(null==e?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...x.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...x.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...x.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...x.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...x.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...x.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...x.errToObj(t)})}nonempty(e){return this.min(1,x.errToObj(e))}trim(){return new N({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new N({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new N({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuer?n:r;return parseInt(e.toFixed(i).replace(".",""))%parseInt(t.toFixed(i).replace(".",""))/Math.pow(10,i)}N.create=e=>{var t;return new N({checks:[],typeName:Se.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...S(e)})};class M extends O{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==i.number){const e=this._getOrReturnCtx(t);return d(e,{code:o.invalid_type,expected:i.number,received:e.parsedType}),h}let n;const r=new p;for(const i of this._def.checks)"int"===i.kind?e.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),d(n,{code:o.invalid_type,expected:"integer",received:"float",message:i.message}),r.dirty()):"min"===i.kind?(i.inclusive?t.datai.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),d(n,{code:o.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):"multipleOf"===i.kind?0!==P(t.data,i.value)&&(n=this._getOrReturnCtx(t,n),d(n,{code:o.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):"finite"===i.kind?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),d(n,{code:o.not_finite,message:i.message}),r.dirty()):e.assertNever(i);return{status:r.value,value:t.data}}gte(e,t){return this.setLimit("min",e,!0,x.toString(t))}gt(e,t){return this.setLimit("min",e,!1,x.toString(t))}lte(e,t){return this.setLimit("max",e,!0,x.toString(t))}lt(e,t){return this.setLimit("max",e,!1,x.toString(t))}setLimit(e,t,n,r){return new M({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:x.toString(r)}]})}_addCheck(e){return new M({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:x.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:x.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:x.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:x.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:x.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:x.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:x.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:x.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:x.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value"int"===t.kind||"multipleOf"===t.kind&&e.isInteger(t.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.valuenew M({checks:[],typeName:Se.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...S(e)});class $ extends O{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==i.bigint){const e=this._getOrReturnCtx(t);return d(e,{code:o.invalid_type,expected:i.bigint,received:e.parsedType}),h}let n;const r=new p;for(const i of this._def.checks)"min"===i.kind?(i.inclusive?t.datai.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),d(n,{code:o.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):"multipleOf"===i.kind?t.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),d(n,{code:o.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):e.assertNever(i);return{status:r.value,value:t.data}}gte(e,t){return this.setLimit("min",e,!0,x.toString(t))}gt(e,t){return this.setLimit("min",e,!1,x.toString(t))}lte(e,t){return this.setLimit("max",e,!0,x.toString(t))}lt(e,t){return this.setLimit("max",e,!1,x.toString(t))}setLimit(e,t,n,r){return new $({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:x.toString(r)}]})}_addCheck(e){return new $({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:x.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:x.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:x.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:x.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:x.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value{var t;return new $({checks:[],typeName:Se.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...S(e)})};class z extends O{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==i.boolean){const t=this._getOrReturnCtx(e);return d(t,{code:o.invalid_type,expected:i.boolean,received:t.parsedType}),h}return v(e.data)}}z.create=e=>new z({typeName:Se.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...S(e)});class B extends O{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==i.date){const e=this._getOrReturnCtx(t);return d(e,{code:o.invalid_type,expected:i.date,received:e.parsedType}),h}if(isNaN(t.data.getTime()))return d(this._getOrReturnCtx(t),{code:o.invalid_date}),h;const n=new p;let r;for(const i of this._def.checks)"min"===i.kind?t.data.getTime()i.value&&(r=this._getOrReturnCtx(t,r),d(r,{code:o.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):e.assertNever(i);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(e){return new B({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:x.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:x.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuenew B({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Se.ZodDate,...S(e)});class L extends O{_parse(e){if(this._getType(e)!==i.symbol){const t=this._getOrReturnCtx(e);return d(t,{code:o.invalid_type,expected:i.symbol,received:t.parsedType}),h}return v(e.data)}}L.create=e=>new L({typeName:Se.ZodSymbol,...S(e)});class W extends O{_parse(e){if(this._getType(e)!==i.undefined){const t=this._getOrReturnCtx(e);return d(t,{code:o.invalid_type,expected:i.undefined,received:t.parsedType}),h}return v(e.data)}}W.create=e=>new W({typeName:Se.ZodUndefined,...S(e)});class D extends O{_parse(e){if(this._getType(e)!==i.null){const t=this._getOrReturnCtx(e);return d(t,{code:o.invalid_type,expected:i.null,received:t.parsedType}),h}return v(e.data)}}D.create=e=>new D({typeName:Se.ZodNull,...S(e)});class F extends O{constructor(){super(...arguments),this._any=!0}_parse(e){return v(e.data)}}F.create=e=>new F({typeName:Se.ZodAny,...S(e)});class U extends O{constructor(){super(...arguments),this._unknown=!0}_parse(e){return v(e.data)}}U.create=e=>new U({typeName:Se.ZodUnknown,...S(e)});class V extends O{_parse(e){const t=this._getOrReturnCtx(e);return d(t,{code:o.invalid_type,expected:i.never,received:t.parsedType}),h}}V.create=e=>new V({typeName:Se.ZodNever,...S(e)});class K extends O{_parse(e){if(this._getType(e)!==i.undefined){const t=this._getOrReturnCtx(e);return d(t,{code:o.invalid_type,expected:i.void,received:t.parsedType}),h}return v(e.data)}}K.create=e=>new K({typeName:Se.ZodVoid,...S(e)});class q extends O{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==i.array)return d(t,{code:o.invalid_type,expected:i.array,received:t.parsedType}),h;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,i=t.data.lengthr.maxLength.value&&(d(t,{code:o.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>r.type._parseAsync(new w(t,e,t.path,n))))).then((e=>p.mergeArray(n,e)));const a=[...t.data].map(((e,n)=>r.type._parseSync(new w(t,e,t.path,n))));return p.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new q({...this._def,minLength:{value:e,message:x.toString(t)}})}max(e,t){return new q({...this._def,maxLength:{value:e,message:x.toString(t)}})}length(e,t){return new q({...this._def,exactLength:{value:e,message:x.toString(t)}})}nonempty(e){return this.min(1,e)}}function G(e){if(e instanceof H){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=pe.create(G(r))}return new H({...e._def,shape:()=>t})}return e instanceof q?new q({...e._def,type:G(e.element)}):e instanceof pe?pe.create(G(e.unwrap())):e instanceof he?he.create(G(e.unwrap())):e instanceof te?te.create(e.items.map((e=>G(e)))):e}q.create=(e,t)=>new q({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Se.ZodArray,...S(t)});class H extends O{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const t=this._def.shape(),n=e.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(e){if(this._getType(e)!==i.object){const t=this._getOrReturnCtx(e);return d(t,{code:o.invalid_type,expected:i.object,received:t.parsedType}),h}const{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof V&&"strip"===this._def.unknownKeys))for(const e in n.data)a.includes(e)||s.push(e);const u=[];for(const e of a){const t=r[e],i=n.data[e];u.push({key:{status:"valid",value:e},value:t._parse(new w(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof V){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of s)u.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)s.length>0&&(d(n,{code:o.unrecognized_keys,keys:s}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of s){const r=n.data[t];u.push({key:{status:"valid",value:t},value:e._parse(new w(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of u){const n=await t.key;e.push({key:n,value:await t.value,alwaysSet:t.alwaysSet})}return e})).then((e=>p.mergeObjectSync(t,e))):p.mergeObjectSync(t,u)}get shape(){return this._def.shape()}strict(e){return x.errToObj,new H({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var r,i,a,o;const s=null!==(a=null===(i=(r=this._def).errorMap)||void 0===i?void 0:i.call(r,t,n).message)&&void 0!==a?a:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(o=x.errToObj(e).message)&&void 0!==o?o:s}:{message:s}}}:{}})}strip(){return new H({...this._def,unknownKeys:"strip"})}passthrough(){return new H({...this._def,unknownKeys:"passthrough"})}extend(e){return new H({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new H({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Se.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new H({...this._def,catchall:e})}pick(t){const n={};return e.objectKeys(t).forEach((e=>{t[e]&&this.shape[e]&&(n[e]=this.shape[e])})),new H({...this._def,shape:()=>n})}omit(t){const n={};return e.objectKeys(this.shape).forEach((e=>{t[e]||(n[e]=this.shape[e])})),new H({...this._def,shape:()=>n})}deepPartial(){return G(this)}partial(t){const n={};return e.objectKeys(this.shape).forEach((e=>{const r=this.shape[e];t&&!t[e]?n[e]=r:n[e]=r.optional()})),new H({...this._def,shape:()=>n})}required(t){const n={};return e.objectKeys(this.shape).forEach((e=>{if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof pe;)t=t._def.innerType;n[e]=t}})),new H({...this._def,shape:()=>n})}keyof(){return ue(e.objectKeys(this.shape))}}H.create=(e,t)=>new H({shape:()=>e,unknownKeys:"strip",catchall:V.create(),typeName:Se.ZodObject,...S(t)}),H.strictCreate=(e,t)=>new H({shape:()=>e,unknownKeys:"strict",catchall:V.create(),typeName:Se.ZodObject,...S(t)}),H.lazycreate=(e,t)=>new H({shape:e,unknownKeys:"strip",catchall:V.create(),typeName:Se.ZodObject,...S(t)});class X extends O{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const n=e.map((e=>new s(e.ctx.common.issues)));return d(t,{code:o.invalid_union,unionErrors:n}),h}));{let e;const r=[];for(const i of n){const n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if("valid"===a.status)return a;"dirty"!==a.status||e||(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const i=r.map((e=>new s(e)));return d(t,{code:o.invalid_union,unionErrors:i}),h}}get options(){return this._def.options}}X.create=(e,t)=>new X({options:e,typeName:Se.ZodUnion,...S(t)});const J=e=>e instanceof oe?J(e.schema):e instanceof de?J(e.innerType()):e instanceof se?[e.value]:e instanceof ce?e.options:e instanceof le?Object.keys(e.enum):e instanceof me?J(e._def.innerType):e instanceof W?[void 0]:e instanceof D?[null]:null;class Y extends O{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==i.object)return d(t,{code:o.invalid_type,expected:i.object,received:t.parsedType}),h;const n=this.discriminator,r=t.data[n],a=this.optionsMap.get(r);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(d(t,{code:o.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),h)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const r=new Map;for(const n of t){const t=J(n.shape[e]);if(!t)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const i of t){if(r.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);r.set(i,n)}}return new Y({typeName:Se.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...S(n)})}}function Q(t,n){const r=a(t),o=a(n);if(t===n)return{valid:!0,data:t};if(r===i.object&&o===i.object){const r=e.objectKeys(n),i=e.objectKeys(t).filter((e=>-1!==r.indexOf(e))),a={...t,...n};for(const e of i){const r=Q(t[e],n[e]);if(!r.valid)return{valid:!1};a[e]=r.data}return{valid:!0,data:a}}if(r===i.array&&o===i.array){if(t.length!==n.length)return{valid:!1};const e=[];for(let r=0;r{if(g(e)||g(r))return h;const i=Q(e.value,r.value);return i.valid?((_(e)||_(r))&&t.dirty(),{status:t.value,value:i.data}):(d(n,{code:o.invalid_intersection_types}),h)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then((([e,t])=>r(e,t))):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}ee.create=(e,t,n)=>new ee({left:e,right:t,typeName:Se.ZodIntersection,...S(n)});class te extends O{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==i.array)return d(n,{code:o.invalid_type,expected:i.array,received:n.parsedType}),h;if(n.data.lengththis._def.items.length&&(d(n,{code:o.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...n.data].map(((e,t)=>{const r=this._def.items[t]||this._def.rest;return r?r._parse(new w(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(r).then((e=>p.mergeArray(t,e))):p.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new te({...this._def,rest:e})}}te.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new te({items:e,typeName:Se.ZodTuple,rest:null,...S(t)})};class ne extends O{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==i.object)return d(n,{code:o.invalid_type,expected:i.object,received:n.parsedType}),h;const r=[],a=this._def.keyType,s=this._def.valueType;for(const e in n.data)r.push({key:a._parse(new w(n,e,n.path,e)),value:s._parse(new w(n,n.data[e],n.path,e))});return n.common.async?p.mergeObjectAsync(t,r):p.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,n){return new ne(t instanceof O?{keyType:e,valueType:t,typeName:Se.ZodRecord,...S(n)}:{keyType:N.create(),valueType:e,typeName:Se.ZodRecord,...S(t)})}}class re extends O{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==i.map)return d(n,{code:o.invalid_type,expected:i.map,received:n.parsedType}),h;const r=this._def.keyType,a=this._def.valueType,s=[...n.data.entries()].map((([e,t],i)=>({key:r._parse(new w(n,e,n.path,[i,"key"])),value:a._parse(new w(n,t,n.path,[i,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of s){const r=await n.key,i=await n.value;if("aborted"===r.status||"aborted"===i.status)return h;"dirty"!==r.status&&"dirty"!==i.status||t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of s){const r=n.key,i=n.value;if("aborted"===r.status||"aborted"===i.status)return h;"dirty"!==r.status&&"dirty"!==i.status||t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}}re.create=(e,t,n)=>new re({valueType:t,keyType:e,typeName:Se.ZodMap,...S(n)});class ie extends O{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==i.set)return d(n,{code:o.invalid_type,expected:i.set,received:n.parsedType}),h;const r=this._def;null!==r.minSize&&n.data.sizer.maxSize.value&&(d(n,{code:o.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const a=this._def.valueType;function s(e){const n=new Set;for(const r of e){if("aborted"===r.status)return h;"dirty"===r.status&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}const u=[...n.data.values()].map(((e,t)=>a._parse(new w(n,e,n.path,t))));return n.common.async?Promise.all(u).then((e=>s(e))):s(u)}min(e,t){return new ie({...this._def,minSize:{value:e,message:x.toString(t)}})}max(e,t){return new ie({...this._def,maxSize:{value:e,message:x.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}ie.create=(e,t)=>new ie({valueType:e,minSize:null,maxSize:null,typeName:Se.ZodSet,...S(t)});class ae extends O{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==i.function)return d(t,{code:o.invalid_type,expected:i.function,received:t.parsedType}),h;function n(e,n){return f({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,l(),u].filter((e=>!!e)),issueData:{code:o.invalid_arguments,argumentsError:n}})}function r(e,n){return f({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,l(),u].filter((e=>!!e)),issueData:{code:o.invalid_return_type,returnTypeError:n}})}const a={errorMap:t.common.contextualErrorMap},c=t.data;if(this._def.returns instanceof fe){const e=this;return v((async function(...t){const i=new s([]),o=await e._def.args.parseAsync(t,a).catch((e=>{throw i.addIssue(n(t,e)),i})),u=await Reflect.apply(c,this,o);return await e._def.returns._def.type.parseAsync(u,a).catch((e=>{throw i.addIssue(r(u,e)),i}))}))}{const e=this;return v((function(...t){const i=e._def.args.safeParse(t,a);if(!i.success)throw new s([n(t,i.error)]);const o=Reflect.apply(c,this,i.data),u=e._def.returns.safeParse(o,a);if(!u.success)throw new s([r(o,u.error)]);return u.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ae({...this._def,args:te.create(e).rest(U.create())})}returns(e){return new ae({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new ae({args:e||te.create([]).rest(U.create()),returns:t||U.create(),typeName:Se.ZodFunction,...S(n)})}}class oe extends O{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}oe.create=(e,t)=>new oe({getter:e,typeName:Se.ZodLazy,...S(t)});class se extends O{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return d(t,{received:t.data,code:o.invalid_literal,expected:this._def.value}),h}return{status:"valid",value:e.data}}get value(){return this._def.value}}function ue(e,t){return new ce({values:e,typeName:Se.ZodEnum,...S(t)})}se.create=(e,t)=>new se({value:e,typeName:Se.ZodLiteral,...S(t)});class ce extends O{_parse(t){if("string"!=typeof t.data){const n=this._getOrReturnCtx(t),r=this._def.values;return d(n,{expected:e.joinValues(r),received:n.parsedType,code:o.invalid_type}),h}if(-1===this._def.values.indexOf(t.data)){const e=this._getOrReturnCtx(t),n=this._def.values;return d(e,{received:e.data,code:o.invalid_enum_value,options:n}),h}return v(t.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e){return ce.create(e)}exclude(e){return ce.create(this.options.filter((t=>!e.includes(t))))}}ce.create=ue;class le extends O{_parse(t){const n=e.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==i.string&&r.parsedType!==i.number){const t=e.objectValues(n);return d(r,{expected:e.joinValues(t),received:r.parsedType,code:o.invalid_type}),h}if(-1===n.indexOf(t.data)){const t=e.objectValues(n);return d(r,{received:r.data,code:o.invalid_enum_value,options:t}),h}return v(t.data)}get enum(){return this._def.values}}le.create=(e,t)=>new le({values:e,typeName:Se.ZodNativeEnum,...S(t)});class fe extends O{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==i.promise&&!1===t.common.async)return d(t,{code:o.invalid_type,expected:i.promise,received:t.parsedType}),h;const n=t.parsedType===i.promise?t.data:Promise.resolve(t.data);return v(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}fe.create=(e,t)=>new fe({type:e,typeName:Se.ZodPromise,...S(t)});class de extends O{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Se.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=this._def.effect||null,a={addIssue:e=>{d(r,e),e.fatal?n.abort():n.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),"preprocess"===i.type){const e=i.transform(r.data,a);return r.common.issues.length?{status:"dirty",value:r.data}:r.common.async?Promise.resolve(e).then((e=>this._def.schema._parseAsync({data:e,path:r.path,parent:r}))):this._def.schema._parseSync({data:e,path:r.path,parent:r})}if("refinement"===i.type){const e=e=>{const t=i.refinement(e,a);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===r.common.async){const t=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===t.status?h:("dirty"===t.status&&n.dirty(),e(t.value),{status:n.value,value:t.value})}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((t=>"aborted"===t.status?h:("dirty"===t.status&&n.dirty(),e(t.value).then((()=>({status:n.value,value:t.value}))))))}if("transform"===i.type){if(!1===r.common.async){const e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!y(e))return e;const t=i.transform(e.value,a);if(t instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:t}}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((e=>y(e)?Promise.resolve(i.transform(e.value,a)).then((e=>({status:n.value,value:e}))):e))}e.assertNever(i)}}de.create=(e,t,n)=>new de({schema:e,typeName:Se.ZodEffects,effect:t,...S(n)}),de.createWithPreprocess=(e,t,n)=>new de({schema:t,effect:{type:"preprocess",transform:e},typeName:Se.ZodEffects,...S(n)});class pe extends O{_parse(e){return this._getType(e)===i.undefined?v(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}pe.create=(e,t)=>new pe({innerType:e,typeName:Se.ZodOptional,...S(t)});class he extends O{_parse(e){return this._getType(e)===i.null?v(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}he.create=(e,t)=>new he({innerType:e,typeName:Se.ZodNullable,...S(t)});class me extends O{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===i.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}me.create=(e,t)=>new me({innerType:e,typeName:Se.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...S(t)});class ve extends O{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return b(r)?r.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new s(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new s(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}ve.create=(e,t)=>new ve({innerType:e,typeName:Se.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...S(t)});class ge extends O{_parse(e){if(this._getType(e)!==i.nan){const t=this._getOrReturnCtx(e);return d(t,{code:o.invalid_type,expected:i.nan,received:t.parsedType}),h}return{status:"valid",value:e.data}}}ge.create=e=>new ge({typeName:Se.ZodNaN,...S(e)});const _e=Symbol("zod_brand");class ye extends O{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class be extends O{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?h:"dirty"===e.status?(t.dirty(),m(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?h:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new be({in:e,out:t,typeName:Se.ZodPipeline})}}class xe extends O{_parse(e){const t=this._def.innerType._parse(e);return y(t)&&(t.value=Object.freeze(t.value)),t}}xe.create=(e,t)=>new xe({innerType:e,typeName:Se.ZodReadonly,...S(t)});const we=(e,t={},n)=>e?F.create().superRefine(((r,i)=>{var a,o;if(!e(r)){const e="function"==typeof t?t(r):"string"==typeof t?{message:t}:t,s=null===(o=null!==(a=e.fatal)&&void 0!==a?a:n)||void 0===o||o,u="string"==typeof e?{message:e}:e;i.addIssue({code:"custom",...u,fatal:s})}})):F.create(),ke={object:H.lazycreate};var Se;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Se||(Se={}));const Oe=N.create,Te=M.create,Ee=ge.create,je=$.create,Ce=z.create,Ae=B.create,Ze=L.create,Ie=W.create,Re=D.create,Ne=F.create,Pe=U.create,Me=V.create,$e=K.create,ze=q.create,Be=H.create,Le=H.strictCreate,We=X.create,De=Y.create,Fe=ee.create,Ue=te.create,Ve=ne.create,Ke=re.create,qe=ie.create,Ge=ae.create,He=oe.create,Xe=se.create,Je=ce.create,Ye=le.create,Qe=fe.create,et=de.create,tt=pe.create,nt=he.create,rt=de.createWithPreprocess,it=be.create,at={string:e=>N.create({...e,coerce:!0}),number:e=>M.create({...e,coerce:!0}),boolean:e=>z.create({...e,coerce:!0}),bigint:e=>$.create({...e,coerce:!0}),date:e=>B.create({...e,coerce:!0})},ot=h;var st=Object.freeze({__proto__:null,defaultErrorMap:u,setErrorMap:function(e){c=e},getErrorMap:l,makeIssue:f,EMPTY_PATH:[],addIssueToContext:d,ParseStatus:p,INVALID:h,DIRTY:m,OK:v,isAborted:g,isDirty:_,isValid:y,isAsync:b,get util(){return e},get objectUtil(){return t},ZodParsedType:i,getParsedType:a,ZodType:O,ZodString:N,ZodNumber:M,ZodBigInt:$,ZodBoolean:z,ZodDate:B,ZodSymbol:L,ZodUndefined:W,ZodNull:D,ZodAny:F,ZodUnknown:U,ZodNever:V,ZodVoid:K,ZodArray:q,ZodObject:H,ZodUnion:X,ZodDiscriminatedUnion:Y,ZodIntersection:ee,ZodTuple:te,ZodRecord:ne,ZodMap:re,ZodSet:ie,ZodFunction:ae,ZodLazy:oe,ZodLiteral:se,ZodEnum:ce,ZodNativeEnum:le,ZodPromise:fe,ZodEffects:de,ZodTransformer:de,ZodOptional:pe,ZodNullable:he,ZodDefault:me,ZodCatch:ve,ZodNaN:ge,BRAND:_e,ZodBranded:ye,ZodPipeline:be,ZodReadonly:xe,custom:we,Schema:O,ZodSchema:O,late:ke,get ZodFirstPartyTypeKind(){return Se},coerce:at,any:Ne,array:ze,bigint:je,boolean:Ce,date:Ae,discriminatedUnion:De,effect:et,enum:Je,function:Ge,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>we((t=>t instanceof e),t),intersection:Fe,lazy:He,literal:Xe,map:Ke,nan:Ee,nativeEnum:Ye,never:Me,null:Re,nullable:nt,number:Te,object:Be,oboolean:()=>Ce().optional(),onumber:()=>Te().optional(),optional:tt,ostring:()=>Oe().optional(),pipeline:it,preprocess:rt,promise:Qe,record:Ve,set:qe,strictObject:Le,string:Oe,symbol:Ze,transformer:et,tuple:Ue,undefined:Ie,union:We,unknown:Pe,void:$e,NEVER:ot,ZodIssueCode:o,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:s}),ut=n(215),ct=new(n.n(ut)().Suite);const lt={};ct.on("complete",(function(){const e=ct.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:lt[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),ct.add("Check a valid model with Zod typecheck",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=st.object({id:st.number(),name:st.string(),age:st.number(),isHappy:st.boolean(),createdAt:st.date(),updatedAt:st.date().nullable(),favoriteColors:st.array(st.string()),favoriteNumbers:st.array(st.number()),favoriteFoods:st.array(st.object({name:st.string(),calories:st.number()}))}),n={id:1,name:"John",age:42,isHappy:!0,createdAt:new Date,updatedAt:null,favoriteColors:["blue","green"],favoriteNumbers:[1,2,3],favoriteFoods:[{name:"Pizza",calories:1e3}]};var r,i;t.parse(n),r="Check a valid model with Zod typecheck",i=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,lt[r]?lt[r]=Math.max(lt[r],i):lt[r]=i})),ct.on("cycle",(function(e){console.log(String(e.target))})),ct.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/check-a-valid-model-with-zod-typecheck-web-bundle.js.LICENSE.txt b/build/check-a-valid-model-with-zod-typecheck-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..5168058 --- /dev/null +++ b/build/check-a-valid-model-with-zod-typecheck-web-bundle.js.LICENSE.txt @@ -0,0 +1,23 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/check-a-valid-snapshot-with-mst-typecheck-bundle-source.js b/build/check-a-valid-snapshot-with-mst-typecheck-bundle-source.js new file mode 100644 index 0000000..cf81855 --- /dev/null +++ b/build/check-a-valid-snapshot-with-mst-typecheck-bundle-source.js @@ -0,0 +1,117 @@ + +import { types, typecheck } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Check a valid snapshot with MST typecheck", () => { + const startMemory = getStartMemory(); + const ExampleModelMST = types.model({ + id: types.identifier, + name: types.string, + age: types.number, + isHappy: types.boolean, + createdAt: types.Date, + updatedAt: types.maybeNull(types.Date), + favoriteColors: types.array(types.string), + favoriteNumbers: types.array(types.number), + favoriteFoods: types.array( + types.model({ + name: types.string, + calories: types.number, + }) + ), +}); + +typecheck(ExampleModelMST, { + id: "1", + name: "John", + age: 42, + isHappy: true, + createdAt: new Date(), + updatedAt: null, + favoriteColors: ["blue", "green"], + favoriteNumbers: [1, 2, 3], + favoriteFoods: [ + { + name: "Pizza", + calories: 1000, + }, + ], +}); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Check a valid snapshot with MST typecheck", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/check-a-valid-snapshot-with-mst-typecheck-node-bundle.js b/build/check-a-valid-snapshot-with-mst-typecheck-node-bundle.js new file mode 100644 index 0000000..ed1d3b8 --- /dev/null +++ b/build/check-a-valid-snapshot-with-mst-typecheck-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see check-a-valid-snapshot-with-mst-typecheck-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===J}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,$e(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),Je(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U($(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=kt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function kt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var Dt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function Jt(e){return Br(e)?e[F].keys_():Cr(e)||kr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function $t(e){return Br(e)?Jt(e).map((function(t){return e[t]})):Cr(e)?Jt(e).map((function(t){return e.get(t)})):kr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||kr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):kr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||kr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Yn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw ci("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Na(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Yn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=si,this.state=Yn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=Yn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw ci(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ti(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(ei(i=n.context,1),ti(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(si),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ai(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw ci("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw ci("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ii);if(!(""===e||"."===e||".."===e||Pi(e,"/")||Pi(e,"./")||Pi(e,"../")))throw ci("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ii(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),mi(this.storedValue,"$treenode",this),mi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Yn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=kt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new wi),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ti(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:Oi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Qn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Qn(t)?"value of type "+ti(t).type.name+":":yi(t)?"value":"snapshot",o=r&&Qn(t)&&r.is(ti(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return kn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||yi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return ui}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&qn(e,t)}function qn(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw ci(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}var Yn,Jn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Jn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],li));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw ci("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;$t(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?Jt(n).map((function(e){return[e,n[e]]})):Cr(n)?Jt(n).map((function(e){return[e,n.get(e)]})):kr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw ci("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Xn(e,t,r,n,i){var a=ri(i);if(a){if(a.parent)throw ci("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Zn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Qn(e){return!(!e||!e.$treenode)}function ei(e,t){ji()}function ti(e){if(!Qn(e))throw ci("Value "+e+" is no MST Node");return e.$treenode}function ri(e){return e&&e.$treenode||null}function ni(){return ti(this).snapshot}function ii(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Qn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Qn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Vi?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=kn(e)?this._subtype:Qn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Vi&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),ki="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=hi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Wi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Ri=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw ci("Map.put cannot be used to set empty values");if(Qn(e)){var t=ti(e);if(null===t.identifier)throw ci(ki);return this.set(t.identifier,e),e}if(vi(e)){var r=ti(this),n=r.type;if(n.identifierMode!==Ci.YES)throw ci(ki);var i=e[n.mapIdentifierAttribute];if(!Ca(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Na(i);return this.set(o,e),this.get(o)}throw ci("Map.put can only be used to store complex values")}}),t}(Nr),Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw ci("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Ri(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);mi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return $t(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw ci("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ti(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw ci("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ti(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ti(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ti(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ti(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return di(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return si}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Li.prototype.applySnapshot=Tt(Li.prototype.applySnapshot);var Mi=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},li),{name:this.name});return Ae.array(ai(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);mi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Qn(e)?ti(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),ua=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw ci("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw ci("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function ca(e,t,r){return function(e,t){if("function"!=typeof t&&Qn(t))throw ci("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dn()}(0,t),new la(e,t,r||fa)}var fa=[void 0],pa=ca(ta,void 0),ba=ca(ea,null);function ha(e){return Dn(),sa(e,pa)}var da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw ci("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),va=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Zn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):gi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),ya=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Zn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return gi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ga=new ya,ma=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Ca(e))this.identifier=e;else{if(!Qn(e))throw ci("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ti(e);if(!r.identifierAttribute)throw ci("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw ci("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Na(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new _a("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),_a=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),wa=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Ca(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;kn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ti(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Na(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Yn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),Oa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Qn(n)?(ei(i=n),ti(i).identifier):n,o=new ma(n,this.targetType),u=Zn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Qn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(wa),Pa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Qn(n)?this.options.set(n,e?e.storedValue:null):n,a=Zn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Qn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(wa);function ja(e,t){Dn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Pa(e,{get:r.get,set:r.set},n):new Oa(e,n)}var Sa=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Wi))throw ci("Identifier types can only be instantiated as direct child of a model type");return Zn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw ci("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Aa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(Sa),Ea=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(Sa),Ta=new Aa,Ia=new Ea;function Na(e){return""+e}function Ca(e){return"string"==typeof e||"number"==typeof e}var Va=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Zn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),xa={enumeration:function(e,t){var r="string"==typeof e?t:e,n=sa.apply(void 0,yn(r.map((function(e){return aa(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dn(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ga:kn(e)?new ya(e):ca(ga,e)},identifier:Ta,identifierNumber:Ia,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new da(r,"string"==typeof e?t:e)},lazy:function(e,t){return new va(e,t)},undefined:ta,null:ea,snapshotProcessor:function(e,t,r){return Dn(),new xi(e,t,r)}};const ka=require("benchmark");var Da=new(e.n(ka)().Suite);const Ra={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ra[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Check a valid snapshot with MST typecheck",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,r;qn(xa.model({id:xa.identifier,name:xa.string,age:xa.number,isHappy:xa.boolean,createdAt:xa.Date,updatedAt:xa.maybeNull(xa.Date),favoriteColors:xa.array(xa.string),favoriteNumbers:xa.array(xa.number),favoriteFoods:xa.array(xa.model({name:xa.string,calories:xa.number}))}),{id:"1",name:"John",age:42,isHappy:!0,createdAt:new Date,updatedAt:null,favoriteColors:["blue","green"],favoriteNumbers:[1,2,3],favoriteFoods:[{name:"Pizza",calories:1e3}]}),t="Check a valid snapshot with MST typecheck",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ra[t]?Ra[t]=Math.max(Ra[t],r):Ra[t]=r})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/check-a-valid-snapshot-with-mst-typecheck-node-bundle.js.LICENSE.txt b/build/check-a-valid-snapshot-with-mst-typecheck-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/check-a-valid-snapshot-with-mst-typecheck-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/check-a-valid-snapshot-with-mst-typecheck-web-bundle.js b/build/check-a-valid-snapshot-with-mst-typecheck-web-bundle.js new file mode 100644 index 0000000..27f0eb2 --- /dev/null +++ b/build/check-a-valid-snapshot-with-mst-typecheck-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see check-a-valid-snapshot-with-mst-typecheck-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,s=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),l=a.object&&e&&!e.nodeType&&e,c=s&&l&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(l&&l.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,l=e.Object,c=(e.RegExp,e.String),_=[],m=l.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,le(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=s&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,s={currentTarget:e},l={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),s.type="cycle",s.target=r,n=W(s),l.onCycle.call(e,n),n.aborted||!1===b())s.type="complete",l.onComplete.call(e,W(s));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function se(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function le(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,s=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+s+")"),fnArg:s,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}le=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,s=Z(u.fn),l=u.count=i.count,f=s||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||s);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=l)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=l}if(!v&&!a&&!y){v=o(u,f,a,d=(s||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=l,delete i.error}catch(e){u.count=l,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),le.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,s,l,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:le(t),l=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((s=W("error")).message=t.error,t.emit(s),s.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==l?1:-1:0):f<=(u<5||s<3?0:y[u][s-3])?f==l?1:-1:0},emit:oe,listeners:ae,off:ue,on:se,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,s=u.destination,l=s[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(l)||(r=!0,l=[]),l.length!=e.length&&(r=!0,(l=l.slice(0,e.length)).length=e.length)):t.isObjectLike(l)||(r=!0,l={}),r&&i.push({destination:s,key:n,value:l}),a.push({destination:l,source:e})):t.eq(l,e)||e===o||i.push({destination:s,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,s=[],l=e.stats.sample;function c(){s.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(s,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=l.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=l.length=s.length=0)),_||(f=q(l),y=t.reduce(l,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),s.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",s=32,l=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",l],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",s],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,se=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,le=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,st=parseInt,lt="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=lt||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&<.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=so(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,lt=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=so(t,"DataView"),jn=so(t,"Map"),Pn=so(t,"Promise"),Sn=so(t,"Set"),An=so(t,"WeakMap"),xn=so(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,s=1&t,l=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!s)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,s);if(p==P||p==d||h&&!o){if(u=l||h?{}:ho(e),!s)return l?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,lo(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,s)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?l?to:eo:l?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function sr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function lr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,s=[],l=t.length;if(!u)return s;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,s=u,l=r(u),c=1/0,f=[];s--;){var p=e[s];s&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),l[s]=!n&&(t||a>=120&&p.length>=120)?new Gn(s&&p):i}p=e[0];var h=-1,b=l[0];e:for(;++h=u?s:s*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,s,1),Ke.call(e,s,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):si(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,ns),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,s=e;null!=s&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var l=t?null:Gi(e);if(l)return sn(l);a=!1,i=Zt,s=new Gn}else s=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,s=null===t,l=t==t,c=uu(t);if(!s&&!c&&!a&&e>t||a&&u&&l&&!s&&!c||r&&u&&l||!n&&l||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!s&&"wrapper"==ro(u))var s=new Fn([],!0)}for(r=s?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof l&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?ts))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=lt||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,l,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=s}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=s}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,s,l,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,s=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);l=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return l=i,b&&r?d(e):(r=a=i,s)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(l===i)return function(e){return f=e,l=Eo(y,t),p?d(e):s}(c);if(h)return _i(l),l=Eo(y,t),d(c)}return l===i&&(l=Eo(y,t)),s}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){l!==i&&_i(l),f=0,r=c=a=l=i},_.flush=function(){return l===i?s:g(Sa())},_}var Ia=Kr((function(e,t){return sr(e,1,t)})),ka=Kr((function(e,t,n){return sr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||ds,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var su=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},lu=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?sn:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?st(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)si(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(se)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var es=Ri(),ts=Ri(!0);function ns(e){return e}function rs(e){return Nr("function"==typeof e?e:ar(e,1))}var is=Kr((function(e,t){return function(n){return Er(n,e,t)}})),os=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function as(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function us(){}var ss=Bi(It),ls=Bi(xt),cs=Bi(Dt);function fs(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var ps=Ui(),hs=Ui(!0);function bs(){return[]}function ds(){return!1}var vs,ys=zi((function(e,t){return e+t}),0),gs=Hi("ceil"),_s=zi((function(e,t){return e/t}),1),ms=Hi("floor"),ws=zi((function(e,t){return e*t}),1),Os=Hi("round"),js=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,s=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||su(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||si(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:li(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:li(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=sa,Ln.zip=la,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,as(Ln,Ln),Ln.add=ys,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gs,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_s,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ms,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=ns,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=su,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=lu,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,ns,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,ns)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,ns,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bs,Ln.stubFalse=ds,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=ws,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=us,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var s=n-cn(r);if(s<1)return r;var l=u?gi(u,0,s).join(""):e.slice(0,s);if(o===i)return l+r;if(u&&(s+=l.length-s),iu(o)){if(e.slice(s).search(o)){var c,f=l;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;l=l.slice(0,p===i?s:p)}}else if(e.indexOf(ai(o),s)!=s){var h=l.lastIndexOf(o);h>-1&&(l=l.slice(0,h))}return l+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,as(Ln,(vs={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vs[t]=e)})),vs),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(ns)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,s=t instanceof Un,l=u[0],c=s||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof l&&1!=l.length&&(s=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=s&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,s=a&&u&&"object"==typeof n.g&&n.g;!s||s.global!==s&&s.window!==s&&s.self!==s||(o=s);var l=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=l)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(l=n)?typeof l[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!l[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),s=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!s?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!s?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var s=t[o];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=n[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)lt(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,s=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var l=Vt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(s,l);e.then(c,n)}e=n,s(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function sn(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=l),an(this)){var o=sn(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return l;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=sn(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!sn(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=ln(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=ln(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=ln(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return lr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return lr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var s=r.value;if(!i.has(s))if(n.delete(s))a=!0;else{var l=n.data_.get(s);o.set(s,l)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!sn(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=ln(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!sn(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=ln(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return lr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=sr(e),t=sr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function sr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function lr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Yr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var s=a._childNodes[a.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw ci("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Io(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=si,this.state=qr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=qr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw ci(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&Ei(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(ei(i=r.context,1),ti(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(si),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):oi(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw ci("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw ci("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||ji(e,"/")||ji(e,"./")||ji(e,"../")))throw ci("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ii(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),_i(this.storedValue,"$treenode",this),_i(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var s,l,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(s=r.onError,l=n,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new wi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ti(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:Oi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Qr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Qr(t)?"value of type "+ti(t).type.name+":":yi(t)?"value":"snapshot",a=n&&Qr(t)&&n.is(ti(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||yi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ui}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&Kr(e,t)}function Kr(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw ci(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}var qr,Xr=0,Yr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Xr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw ci("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(r),s=!0)}s&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw ci("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Zr(e,t,n,r,i){var o=ni(i);if(o){if(o.parent)throw ci("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Jr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Qr(e){return!(!e||!e.$treenode)}function ei(e,t){Pi()}function ti(e){if(!Qr(e))throw ci("Value "+e+" is no MST Node");return e.$treenode}function ni(e){return e&&e.$treenode||null}function ri(){return ti(this).snapshot}function ii(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Qr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Qr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===ki?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Qr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==ki&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Vi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=bi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Di(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Gi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ii||(Ii={}));var Ri=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw ci("Map.put cannot be used to set empty values");if(Qr(e)){var t=ti(e);if(null===t.identifier)throw ci(Vi);return this.set(t.identifier,e),e}if(vi(e)){var n=ti(this),r=n.type;if(r.identifierMode!==Ii.YES)throw ci(Vi);var i=e[r.mapIdentifierAttribute];if(!ko(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Io(i);return this.set(a,e),this.get(a)}throw ci("Map.put can only be used to store complex values")}}),t}(In),Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ii.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ii.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw ci("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ii.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ii.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Ri(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);_i(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw ci("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ti(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ii.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw ci("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ti(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return di(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return si}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Mi.prototype.applySnapshot=Et(Mi.prototype.applySnapshot);var Li=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(oi(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);_i(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Qr(e)?ti(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),uo=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw ci("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw ci("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function co(e,t,n){return function(e,t){if("function"!=typeof t&&Qr(t))throw ci("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||fo)}var fo=[void 0],po=co(to,void 0),ho=co(eo,null);function bo(e){return Dr(),so(e,po)}var vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw ci("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),yo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Jr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):gi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),go=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Jr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return gi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),_o=new go,mo=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),ko(e))this.identifier=e;else{if(!Qr(e))throw ci("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ti(e);if(!n.identifierAttribute)throw ci("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw ci("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Io(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new wo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),wo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),Oo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return ko(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ti(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Io(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),jo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Qr(r)?(ei(i=r),ti(i).identifier):r,a=new mo(r,this.targetType),u=Jr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Qr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(Oo),Po=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Qr(r)?this.options.set(r,e?e.storedValue:null):r,o=Jr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Qr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(Oo);function So(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new Po(e,{get:n.get,set:n.set},r):new jo(e,r)}var Ao=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Gi))throw ci("Identifier types can only be instantiated as direct child of a model type");return Jr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw ci("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),xo=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(Ao),Eo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(Ao),To=new xo,Co=new Eo;function Io(e){return""+e}function ko(e){return"string"==typeof e||"number"==typeof e}var No=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Jr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),Vo={enumeration:function(e,t){var n="string"==typeof e?t:e,r=so.apply(void 0,yr(n.map((function(e){return oo(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?_o:Vr(e)?new go(e):co(_o,e)},identifier:To,identifierNumber:Co,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new vo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new yo(e,t)},undefined:to,null:eo,snapshotProcessor:function(e,t,n){return Dr(),new Ni(e,t,n)}},Do=n(215),Ro=new(n.n(Do)().Suite);const Mo={};Ro.on("complete",(function(){const e=Ro.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Mo[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Ro.add("Check a valid snapshot with MST typecheck",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,n;Kr(Vo.model({id:Vo.identifier,name:Vo.string,age:Vo.number,isHappy:Vo.boolean,createdAt:Vo.Date,updatedAt:Vo.maybeNull(Vo.Date),favoriteColors:Vo.array(Vo.string),favoriteNumbers:Vo.array(Vo.number),favoriteFoods:Vo.array(Vo.model({name:Vo.string,calories:Vo.number}))}),{id:"1",name:"John",age:42,isHappy:!0,createdAt:new Date,updatedAt:null,favoriteColors:["blue","green"],favoriteNumbers:[1,2,3],favoriteFoods:[{name:"Pizza",calories:1e3}]}),t="Check a valid snapshot with MST typecheck",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Mo[t]?Mo[t]=Math.max(Mo[t],n):Mo[t]=n})),Ro.on("cycle",(function(e){console.log(String(e.target))})),Ro.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/check-a-valid-snapshot-with-mst-typecheck-web-bundle.js.LICENSE.txt b/build/check-a-valid-snapshot-with-mst-typecheck-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/check-a-valid-snapshot-with-mst-typecheck-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/check-an-invalid-model-with-mst-typecheck-bundle-source.js b/build/check-an-invalid-model-with-mst-typecheck-bundle-source.js new file mode 100644 index 0000000..ae66935 --- /dev/null +++ b/build/check-an-invalid-model-with-mst-typecheck-bundle-source.js @@ -0,0 +1,129 @@ + +import { types, typecheck } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Check an invalid model with MST typecheck", () => { + const startMemory = getStartMemory(); + const ExampleModelMST = types.model({ + id: types.identifier, + name: types.string, + age: types.number, + isHappy: types.boolean, + createdAt: types.Date, + updatedAt: types.maybeNull(types.Date), + favoriteColors: types.array(types.string), + favoriteNumbers: types.array(types.number), + favoriteFoods: types.array( + types.model({ + name: types.string, + calories: types.number, + }) + ), +}); + +const FalseExampleModelMST = types.model({ + id: types.identifier, + shouldMatch: false, +}); + +const model = ExampleModelMST.create({ + id: "1", + name: "John", + age: 42, + isHappy: true, + createdAt: new Date(), + updatedAt: null, + favoriteColors: ["blue", "green"], + favoriteNumbers: [1, 2, 3], + favoriteFoods: [ + { + name: "Pizza", + calories: 1000, + }, + ], +}); + +// We expect an error here from MST, so just catch it and keep going. +try { + typecheck(FalseExampleModelMST, model); +} catch (e) { + return; +} + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Check an invalid model with MST typecheck", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/check-an-invalid-model-with-mst-typecheck-node-bundle.js b/build/check-an-invalid-model-with-mst-typecheck-node-bundle.js new file mode 100644 index 0000000..7c2c388 --- /dev/null +++ b/build/check-an-invalid-model-with-mst-typecheck-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see check-an-invalid-model-with-mst-typecheck-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===J}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,$e(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),Je(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U($(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=kt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function kt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var Dt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function Jt(e){return Br(e)?e[F].keys_():Cr(e)||kr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function $t(e){return Br(e)?Jt(e).map((function(t){return e[t]})):Cr(e)?Jt(e).map((function(t){return e.get(t)})):kr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||kr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):kr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||kr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Yn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw ci("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Na(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Yn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=si,this.state=Yn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=Yn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw ci(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ti(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(ei(i=n.context,1),ti(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(si),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ai(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw ci("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw ci("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ii);if(!(""===e||"."===e||".."===e||Pi(e,"/")||Pi(e,"./")||Pi(e,"../")))throw ci("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ii(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),mi(this.storedValue,"$treenode",this),mi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Yn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=kt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new wi),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ti(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:Oi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Qn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Qn(t)?"value of type "+ti(t).type.name+":":yi(t)?"value":"snapshot",o=r&&Qn(t)&&r.is(ti(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return kn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||yi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return ui}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&qn(e,t)}function qn(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw ci(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}var Yn,Jn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Jn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],li));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw ci("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;$t(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?Jt(n).map((function(e){return[e,n[e]]})):Cr(n)?Jt(n).map((function(e){return[e,n.get(e)]})):kr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw ci("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Xn(e,t,r,n,i){var a=ri(i);if(a){if(a.parent)throw ci("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Zn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Qn(e){return!(!e||!e.$treenode)}function ei(e,t){ji()}function ti(e){if(!Qn(e))throw ci("Value "+e+" is no MST Node");return e.$treenode}function ri(e){return e&&e.$treenode||null}function ni(){return ti(this).snapshot}function ii(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Qn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Qn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Vi?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=kn(e)?this._subtype:Qn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Vi&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),ki="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=hi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Wi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Ri=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw ci("Map.put cannot be used to set empty values");if(Qn(e)){var t=ti(e);if(null===t.identifier)throw ci(ki);return this.set(t.identifier,e),e}if(vi(e)){var r=ti(this),n=r.type;if(n.identifierMode!==Ci.YES)throw ci(ki);var i=e[n.mapIdentifierAttribute];if(!Ca(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Na(i);return this.set(o,e),this.get(o)}throw ci("Map.put can only be used to store complex values")}}),t}(Nr),Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw ci("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Ri(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);mi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return $t(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw ci("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ti(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw ci("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ti(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ti(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ti(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ti(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return di(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return si}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Li.prototype.applySnapshot=Tt(Li.prototype.applySnapshot);var Mi=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},li),{name:this.name});return Ae.array(ai(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);mi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Qn(e)?ti(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),ua=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw ci("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw ci("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function ca(e,t,r){return function(e,t){if("function"!=typeof t&&Qn(t))throw ci("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dn()}(0,t),new la(e,t,r||fa)}var fa=[void 0],pa=ca(ta,void 0),ba=ca(ea,null);function ha(e){return Dn(),sa(e,pa)}var da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw ci("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),va=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Zn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):gi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),ya=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Zn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return gi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ga=new ya,ma=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Ca(e))this.identifier=e;else{if(!Qn(e))throw ci("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ti(e);if(!r.identifierAttribute)throw ci("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw ci("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Na(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new _a("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),_a=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),wa=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Ca(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;kn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ti(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Na(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Yn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),Oa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Qn(n)?(ei(i=n),ti(i).identifier):n,o=new ma(n,this.targetType),u=Zn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Qn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(wa),Pa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Qn(n)?this.options.set(n,e?e.storedValue:null):n,a=Zn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Qn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(wa);function ja(e,t){Dn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Pa(e,{get:r.get,set:r.set},n):new Oa(e,n)}var Sa=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Wi))throw ci("Identifier types can only be instantiated as direct child of a model type");return Zn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw ci("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Aa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(Sa),Ea=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(Sa),Ta=new Aa,Ia=new Ea;function Na(e){return""+e}function Ca(e){return"string"==typeof e||"number"==typeof e}var Va=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Zn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),xa={enumeration:function(e,t){var r="string"==typeof e?t:e,n=sa.apply(void 0,yn(r.map((function(e){return aa(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dn(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ga:kn(e)?new ya(e):ca(ga,e)},identifier:Ta,identifierNumber:Ia,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new da(r,"string"==typeof e?t:e)},lazy:function(e,t){return new va(e,t)},undefined:ta,null:ea,snapshotProcessor:function(e,t,r){return Dn(),new xi(e,t,r)}};const ka=require("benchmark");var Da=new(e.n(ka)().Suite);const Ra={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ra[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Check an invalid model with MST typecheck",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=xa.model({id:xa.identifier,name:xa.string,age:xa.number,isHappy:xa.boolean,createdAt:xa.Date,updatedAt:xa.maybeNull(xa.Date),favoriteColors:xa.array(xa.string),favoriteNumbers:xa.array(xa.number),favoriteFoods:xa.array(xa.model({name:xa.string,calories:xa.number}))}),r=xa.model({id:xa.identifier,shouldMatch:!1}),n=t.create({id:"1",name:"John",age:42,isHappy:!0,createdAt:new Date,updatedAt:null,favoriteColors:["blue","green"],favoriteNumbers:[1,2,3],favoriteFoods:[{name:"Pizza",calories:1e3}]});try{qn(r,n)}catch(e){return}var i,a;i="Check an invalid model with MST typecheck",a=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ra[i]?Ra[i]=Math.max(Ra[i],a):Ra[i]=a})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/check-an-invalid-model-with-mst-typecheck-node-bundle.js.LICENSE.txt b/build/check-an-invalid-model-with-mst-typecheck-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/check-an-invalid-model-with-mst-typecheck-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/check-an-invalid-model-with-mst-typecheck-web-bundle.js b/build/check-an-invalid-model-with-mst-typecheck-web-bundle.js new file mode 100644 index 0000000..b9c99e1 --- /dev/null +++ b/build/check-an-invalid-model-with-mst-typecheck-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see check-an-invalid-model-with-mst-typecheck-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Yr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw ci("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Io(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=li,this.state=qr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=qr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw ci(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&Ei(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(ei(i=r.context,1),ti(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(li),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):oi(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw ci("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw ci("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||ji(e,"/")||ji(e,"./")||ji(e,"../")))throw ci("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ii(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),_i(this.storedValue,"$treenode",this),_i(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new wi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ti(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:Oi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Qr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Qr(t)?"value of type "+ti(t).type.name+":":yi(t)?"value":"snapshot",a=n&&Qr(t)&&n.is(ti(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||yi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ui}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&Kr(e,t)}function Kr(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw ci(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}var qr,Xr=0,Yr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Xr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],si));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw ci("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw ci("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Zr(e,t,n,r,i){var o=ni(i);if(o){if(o.parent)throw ci("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Jr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Qr(e){return!(!e||!e.$treenode)}function ei(e,t){Pi()}function ti(e){if(!Qr(e))throw ci("Value "+e+" is no MST Node");return e.$treenode}function ni(e){return e&&e.$treenode||null}function ri(){return ti(this).snapshot}function ii(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Qr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Qr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===ki?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Qr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==ki&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Vi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=bi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Di(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Gi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ii||(Ii={}));var Ri=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw ci("Map.put cannot be used to set empty values");if(Qr(e)){var t=ti(e);if(null===t.identifier)throw ci(Vi);return this.set(t.identifier,e),e}if(vi(e)){var n=ti(this),r=n.type;if(r.identifierMode!==Ii.YES)throw ci(Vi);var i=e[r.mapIdentifierAttribute];if(!ko(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Io(i);return this.set(a,e),this.get(a)}throw ci("Map.put can only be used to store complex values")}}),t}(In),Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ii.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ii.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw ci("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ii.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ii.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Ri(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);_i(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw ci("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ti(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ii.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw ci("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ti(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return di(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return li}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Mi.prototype.applySnapshot=Et(Mi.prototype.applySnapshot);var Li=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},si),{name:this.name});return Ae.array(oi(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);_i(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Qr(e)?ti(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),uo=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw ci("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw ci("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function co(e,t,n){return function(e,t){if("function"!=typeof t&&Qr(t))throw ci("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new so(e,t,n||fo)}var fo=[void 0],po=co(to,void 0),ho=co(eo,null);function bo(e){return Dr(),lo(e,po)}var vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw ci("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),yo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Jr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):gi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),go=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Jr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return gi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),_o=new go,mo=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),ko(e))this.identifier=e;else{if(!Qr(e))throw ci("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ti(e);if(!n.identifierAttribute)throw ci("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw ci("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Io(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new wo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),wo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),Oo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return ko(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ti(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Io(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),jo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Qr(r)?(ei(i=r),ti(i).identifier):r,a=new mo(r,this.targetType),u=Jr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Qr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(Oo),Po=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Qr(r)?this.options.set(r,e?e.storedValue:null):r,o=Jr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Qr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(Oo);function So(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new Po(e,{get:n.get,set:n.set},r):new jo(e,r)}var Ao=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Gi))throw ci("Identifier types can only be instantiated as direct child of a model type");return Jr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw ci("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),xo=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(Ao),Eo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(Ao),To=new xo,Co=new Eo;function Io(e){return""+e}function ko(e){return"string"==typeof e||"number"==typeof e}var No=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Jr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),Vo={enumeration:function(e,t){var n="string"==typeof e?t:e,r=lo.apply(void 0,yr(n.map((function(e){return oo(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?_o:Vr(e)?new go(e):co(_o,e)},identifier:To,identifierNumber:Co,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new vo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new yo(e,t)},undefined:to,null:eo,snapshotProcessor:function(e,t,n){return Dr(),new Ni(e,t,n)}},Do=n(215),Ro=new(n.n(Do)().Suite);const Mo={};Ro.on("complete",(function(){const e=Ro.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Mo[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Ro.add("Check an invalid model with MST typecheck",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=Vo.model({id:Vo.identifier,name:Vo.string,age:Vo.number,isHappy:Vo.boolean,createdAt:Vo.Date,updatedAt:Vo.maybeNull(Vo.Date),favoriteColors:Vo.array(Vo.string),favoriteNumbers:Vo.array(Vo.number),favoriteFoods:Vo.array(Vo.model({name:Vo.string,calories:Vo.number}))}),n=Vo.model({id:Vo.identifier,shouldMatch:!1}),r=t.create({id:"1",name:"John",age:42,isHappy:!0,createdAt:new Date,updatedAt:null,favoriteColors:["blue","green"],favoriteNumbers:[1,2,3],favoriteFoods:[{name:"Pizza",calories:1e3}]});try{Kr(n,r)}catch(e){return}var i,o;i="Check an invalid model with MST typecheck",o=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Mo[i]?Mo[i]=Math.max(Mo[i],o):Mo[i]=o})),Ro.on("cycle",(function(e){console.log(String(e.target))})),Ro.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/check-an-invalid-model-with-mst-typecheck-web-bundle.js.LICENSE.txt b/build/check-an-invalid-model-with-mst-typecheck-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/check-an-invalid-model-with-mst-typecheck-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/check-an-invalid-model-with-zod-typecheck-bundle-source.js b/build/check-an-invalid-model-with-zod-typecheck-bundle-source.js new file mode 100644 index 0000000..aaba6b0 --- /dev/null +++ b/build/check-an-invalid-model-with-zod-typecheck-bundle-source.js @@ -0,0 +1,112 @@ + +import { z } from "zod"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Check an invalid model with Zod typecheck", () => { + const startMemory = getStartMemory(); + const ExampleSchemaZod = z.object({ + id: z.number(), + name: z.string(), + age: z.number(), + isHappy: z.boolean(), + createdAt: z.date(), + updatedAt: z.date().nullable(), + favoriteColors: z.array(z.string()), + favoriteNumbers: z.array(z.number()), + favoriteFoods: z.array( + z.object({ + name: z.string(), + calories: z.number(), + }) + ), +}); + +const schemaFail = { + id: 1, + name: "John", +}; + +// We expect an error here from Zod, so just catch it and keep going. +try { + ExampleSchemaZod.parse(schemaFail); +} catch (e) { + return; +} + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Check an invalid model with Zod typecheck", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/check-an-invalid-model-with-zod-typecheck-node-bundle.js b/build/check-an-invalid-model-with-zod-typecheck-node-bundle.js new file mode 100644 index 0000000..dac1277 --- /dev/null +++ b/build/check-an-invalid-model-with-zod-typecheck-node-bundle.js @@ -0,0 +1 @@ +(()=>{"use strict";var e,t,a={n:e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},d:(e,t)=>{for(var s in t)a.o(t,s)&&!a.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},s={};a.r(s),function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const a of e)t[a]=a;return t},e.getValidEnumValues=t=>{const a=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),s={};for(const e of a)s[e]=t[e];return e.objectValues(s)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.push(a);return t},e.find=(e,t)=>{for(const a of e)if(t(a))return a},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(e||(e={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(t||(t={}));const n=e.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),r=e=>{switch(typeof e){case"undefined":return n.undefined;case"string":return n.string;case"number":return isNaN(e)?n.nan:n.number;case"boolean":return n.boolean;case"function":return n.function;case"bigint":return n.bigint;case"symbol":return n.symbol;case"object":return Array.isArray(e)?n.array:null===e?n.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?n.promise:"undefined"!=typeof Map&&e instanceof Map?n.map:"undefined"!=typeof Set&&e instanceof Set?n.set:"undefined"!=typeof Date&&e instanceof Date?n.date:n.object;default:return n.unknown}},i=e.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class o extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},a={_errors:[]},s=e=>{for(const n of e.issues)if("invalid_union"===n.code)n.unionErrors.map(s);else if("invalid_return_type"===n.code)s(n.returnTypeError);else if("invalid_arguments"===n.code)s(n.argumentsError);else if(0===n.path.length)a._errors.push(t(n));else{let e=a,s=0;for(;se.message)){const t={},a=[];for(const s of this.issues)s.path.length>0?(t[s.path[0]]=t[s.path[0]]||[],t[s.path[0]].push(e(s))):a.push(e(s));return{formErrors:a,fieldErrors:t}}get formErrors(){return this.flatten()}}o.create=e=>new o(e);const d=(t,a)=>{let s;switch(t.code){case i.invalid_type:s=t.received===n.undefined?"Required":`Expected ${t.expected}, received ${t.received}`;break;case i.invalid_literal:s=`Invalid literal value, expected ${JSON.stringify(t.expected,e.jsonStringifyReplacer)}`;break;case i.unrecognized_keys:s=`Unrecognized key(s) in object: ${e.joinValues(t.keys,", ")}`;break;case i.invalid_union:s="Invalid input";break;case i.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${e.joinValues(t.options)}`;break;case i.invalid_enum_value:s=`Invalid enum value. Expected ${e.joinValues(t.options)}, received '${t.received}'`;break;case i.invalid_arguments:s="Invalid function arguments";break;case i.invalid_return_type:s="Invalid function return type";break;case i.invalid_date:s="Invalid date";break;case i.invalid_string:"object"==typeof t.validation?"includes"in t.validation?(s=`Invalid input: must include "${t.validation.includes}"`,"number"==typeof t.validation.position&&(s=`${s} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?s=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?s=`Invalid input: must end with "${t.validation.endsWith}"`:e.assertNever(t.validation):s="regex"!==t.validation?`Invalid ${t.validation}`:"Invalid";break;case i.too_small:s="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:"number"===t.type?`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:"date"===t.type?`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:"Invalid input";break;case i.too_big:s="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:"number"===t.type?`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"bigint"===t.type?`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"date"===t.type?`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:"Invalid input";break;case i.custom:s="Invalid input";break;case i.invalid_intersection_types:s="Intersection results could not be merged";break;case i.not_multiple_of:s=`Number must be a multiple of ${t.multipleOf}`;break;case i.not_finite:s="Number must be finite";break;default:s=a.defaultError,e.assertNever(t)}return{message:s}};let c=d;function u(){return c}const l=e=>{const{data:t,path:a,errorMaps:s,issueData:n}=e,r=[...a,...n.path||[]],i={...n,path:r};let o="";const d=s.filter((e=>!!e)).slice().reverse();for(const e of d)o=e(i,{data:t,defaultError:o}).message;return{...n,path:r,message:n.message||o}};function p(e,t){const a=l({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,u(),d].filter((e=>!!e))});e.common.issues.push(a)}class h{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const a=[];for(const s of t){if("aborted"===s.status)return m;"dirty"===s.status&&e.dirty(),a.push(s.value)}return{status:e.value,value:a}}static async mergeObjectAsync(e,t){const a=[];for(const e of t)a.push({key:await e.key,value:await e.value});return h.mergeObjectSync(e,a)}static mergeObjectSync(e,t){const a={};for(const s of t){const{key:t,value:n}=s;if("aborted"===t.status)return m;if("aborted"===n.status)return m;"dirty"===t.status&&e.dirty(),"dirty"===n.status&&e.dirty(),"__proto__"===t.value||void 0===n.value&&!s.alwaysSet||(a[t.value]=n.value)}return{status:e.value,value:a}}}const m=Object.freeze({status:"aborted"}),f=e=>({status:"dirty",value:e}),y=e=>({status:"valid",value:e}),_=e=>"aborted"===e.status,v=e=>"dirty"===e.status,g=e=>"valid"===e.status,x=e=>"undefined"!=typeof Promise&&e instanceof Promise;var b;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(b||(b={}));class k{constructor(e,t,a,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=a,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const w=(e,t)=>{if(g(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new o(e.common.issues);return this._error=t,this._error}}};function Z(e){if(!e)return{};const{errorMap:t,invalid_type_error:a,required_error:s,description:n}=e;if(t&&(a||s))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:n}:{errorMap:(e,t)=>"invalid_type"!==e.code?{message:t.defaultError}:void 0===t.data?{message:null!=s?s:t.defaultError}:{message:null!=a?a:t.defaultError},description:n}}class T{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return r(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:r(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new h,ctx:{common:e.parent.common,data:e.data,parsedType:r(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(x(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const a=this.safeParse(e,t);if(a.success)return a.data;throw a.error}safeParse(e,t){var a;const s={common:{issues:[],async:null!==(a=null==t?void 0:t.async)&&void 0!==a&&a,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:r(e)},n=this._parseSync({data:e,path:s.path,parent:s});return w(s,n)}async parseAsync(e,t){const a=await this.safeParseAsync(e,t);if(a.success)return a.data;throw a.error}async safeParseAsync(e,t){const a={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:r(e)},s=this._parse({data:e,path:a.path,parent:a}),n=await(x(s)?s:Promise.resolve(s));return w(a,n)}refine(e,t){const a=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,s)=>{const n=e(t),r=()=>s.addIssue({code:i.custom,...a(t)});return"undefined"!=typeof Promise&&n instanceof Promise?n.then((e=>!!e||(r(),!1))):!!n||(r(),!1)}))}refinement(e,t){return this._refinement(((a,s)=>!!e(a)||(s.addIssue("function"==typeof t?t(a,s):t),!1)))}_refinement(e){return new pe({schema:this,typeName:Ze.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return he.create(this,this._def)}nullable(){return me.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return q.create(this,this._def)}promise(){return le.create(this,this._def)}or(e){return Y.create([this,e],this._def)}and(e){return ee.create(this,e,this._def)}transform(e){return new pe({...Z(this._def),schema:this,typeName:Ze.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new fe({...Z(this._def),innerType:this,defaultValue:t,typeName:Ze.ZodDefault})}brand(){return new ge({typeName:Ze.ZodBranded,type:this,...Z(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new ye({...Z(this._def),innerType:this,catchValue:t,typeName:Ze.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return xe.create(this,e)}readonly(){return be.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const O=/^c[^\s-]{8,}$/i,S=/^[a-z][a-z0-9]*$/,N=/^[0-9A-HJKMNP-TV-Z]{26}$/,C=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,j=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let E;const I=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,P=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;class R extends T{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==n.string){const e=this._getOrReturnCtx(t);return p(e,{code:i.invalid_type,expected:n.string,received:e.parsedType}),m}const a=new h;let s;for(const n of this._def.checks)if("min"===n.kind)t.data.lengthn.value&&(s=this._getOrReturnCtx(t,s),p(s,{code:i.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),a.dirty());else if("length"===n.kind){const e=t.data.length>n.value,r=t.data.lengthe.test(t)),{validation:t,code:i.invalid_string,...b.errToObj(a)})}_addCheck(e){return new R({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...b.errToObj(e)})}url(e){return this._addCheck({kind:"url",...b.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...b.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...b.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...b.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...b.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...b.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...b.errToObj(e)})}datetime(e){var t;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,...b.errToObj(null==e?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...b.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...b.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...b.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...b.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...b.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...b.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...b.errToObj(t)})}nonempty(e){return this.min(1,b.errToObj(e))}trim(){return new R({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new R({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new R({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.values?a:s;return parseInt(e.toFixed(n).replace(".",""))%parseInt(t.toFixed(n).replace(".",""))/Math.pow(10,n)}R.create=e=>{var t;return new R({checks:[],typeName:Ze.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...Z(e)})};class M extends T{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==n.number){const e=this._getOrReturnCtx(t);return p(e,{code:i.invalid_type,expected:n.number,received:e.parsedType}),m}let a;const s=new h;for(const n of this._def.checks)"int"===n.kind?e.isInteger(t.data)||(a=this._getOrReturnCtx(t,a),p(a,{code:i.invalid_type,expected:"integer",received:"float",message:n.message}),s.dirty()):"min"===n.kind?(n.inclusive?t.datan.value:t.data>=n.value)&&(a=this._getOrReturnCtx(t,a),p(a,{code:i.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),s.dirty()):"multipleOf"===n.kind?0!==A(t.data,n.value)&&(a=this._getOrReturnCtx(t,a),p(a,{code:i.not_multiple_of,multipleOf:n.value,message:n.message}),s.dirty()):"finite"===n.kind?Number.isFinite(t.data)||(a=this._getOrReturnCtx(t,a),p(a,{code:i.not_finite,message:n.message}),s.dirty()):e.assertNever(n);return{status:s.value,value:t.data}}gte(e,t){return this.setLimit("min",e,!0,b.toString(t))}gt(e,t){return this.setLimit("min",e,!1,b.toString(t))}lte(e,t){return this.setLimit("max",e,!0,b.toString(t))}lt(e,t){return this.setLimit("max",e,!1,b.toString(t))}setLimit(e,t,a,s){return new M({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:b.toString(s)}]})}_addCheck(e){return new M({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:b.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:b.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:b.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:b.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:b.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:b.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:b.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:b.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:b.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value"int"===t.kind||"multipleOf"===t.kind&&e.isInteger(t.value)))}get isFinite(){let e=null,t=null;for(const a of this._def.checks){if("finite"===a.kind||"int"===a.kind||"multipleOf"===a.kind)return!0;"min"===a.kind?(null===t||a.value>t)&&(t=a.value):"max"===a.kind&&(null===e||a.valuenew M({checks:[],typeName:Ze.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...Z(e)});class $ extends T{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==n.bigint){const e=this._getOrReturnCtx(t);return p(e,{code:i.invalid_type,expected:n.bigint,received:e.parsedType}),m}let a;const s=new h;for(const n of this._def.checks)"min"===n.kind?(n.inclusive?t.datan.value:t.data>=n.value)&&(a=this._getOrReturnCtx(t,a),p(a,{code:i.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),s.dirty()):"multipleOf"===n.kind?t.data%n.value!==BigInt(0)&&(a=this._getOrReturnCtx(t,a),p(a,{code:i.not_multiple_of,multipleOf:n.value,message:n.message}),s.dirty()):e.assertNever(n);return{status:s.value,value:t.data}}gte(e,t){return this.setLimit("min",e,!0,b.toString(t))}gt(e,t){return this.setLimit("min",e,!1,b.toString(t))}lte(e,t){return this.setLimit("max",e,!0,b.toString(t))}lt(e,t){return this.setLimit("max",e,!1,b.toString(t))}setLimit(e,t,a,s){return new $({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:b.toString(s)}]})}_addCheck(e){return new $({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:b.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:b.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:b.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:b.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:b.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value{var t;return new $({checks:[],typeName:Ze.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...Z(e)})};class L extends T{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==n.boolean){const t=this._getOrReturnCtx(e);return p(t,{code:i.invalid_type,expected:n.boolean,received:t.parsedType}),m}return y(e.data)}}L.create=e=>new L({typeName:Ze.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...Z(e)});class D extends T{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==n.date){const e=this._getOrReturnCtx(t);return p(e,{code:i.invalid_type,expected:n.date,received:e.parsedType}),m}if(isNaN(t.data.getTime()))return p(this._getOrReturnCtx(t),{code:i.invalid_date}),m;const a=new h;let s;for(const n of this._def.checks)"min"===n.kind?t.data.getTime()n.value&&(s=this._getOrReturnCtx(t,s),p(s,{code:i.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),a.dirty()):e.assertNever(n);return{status:a.value,value:new Date(t.data.getTime())}}_addCheck(e){return new D({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:b.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:b.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuenew D({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Ze.ZodDate,...Z(e)});class z extends T{_parse(e){if(this._getType(e)!==n.symbol){const t=this._getOrReturnCtx(e);return p(t,{code:i.invalid_type,expected:n.symbol,received:t.parsedType}),m}return y(e.data)}}z.create=e=>new z({typeName:Ze.ZodSymbol,...Z(e)});class U extends T{_parse(e){if(this._getType(e)!==n.undefined){const t=this._getOrReturnCtx(e);return p(t,{code:i.invalid_type,expected:n.undefined,received:t.parsedType}),m}return y(e.data)}}U.create=e=>new U({typeName:Ze.ZodUndefined,...Z(e)});class V extends T{_parse(e){if(this._getType(e)!==n.null){const t=this._getOrReturnCtx(e);return p(t,{code:i.invalid_type,expected:n.null,received:t.parsedType}),m}return y(e.data)}}V.create=e=>new V({typeName:Ze.ZodNull,...Z(e)});class K extends T{constructor(){super(...arguments),this._any=!0}_parse(e){return y(e.data)}}K.create=e=>new K({typeName:Ze.ZodAny,...Z(e)});class B extends T{constructor(){super(...arguments),this._unknown=!0}_parse(e){return y(e.data)}}B.create=e=>new B({typeName:Ze.ZodUnknown,...Z(e)});class F extends T{_parse(e){const t=this._getOrReturnCtx(e);return p(t,{code:i.invalid_type,expected:n.never,received:t.parsedType}),m}}F.create=e=>new F({typeName:Ze.ZodNever,...Z(e)});class W extends T{_parse(e){if(this._getType(e)!==n.undefined){const t=this._getOrReturnCtx(e);return p(t,{code:i.invalid_type,expected:n.void,received:t.parsedType}),m}return y(e.data)}}W.create=e=>new W({typeName:Ze.ZodVoid,...Z(e)});class q extends T{_parse(e){const{ctx:t,status:a}=this._processInputParams(e),s=this._def;if(t.parsedType!==n.array)return p(t,{code:i.invalid_type,expected:n.array,received:t.parsedType}),m;if(null!==s.exactLength){const e=t.data.length>s.exactLength.value,n=t.data.lengths.maxLength.value&&(p(t,{code:i.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),a.dirty()),t.common.async)return Promise.all([...t.data].map(((e,a)=>s.type._parseAsync(new k(t,e,t.path,a))))).then((e=>h.mergeArray(a,e)));const r=[...t.data].map(((e,a)=>s.type._parseSync(new k(t,e,t.path,a))));return h.mergeArray(a,r)}get element(){return this._def.type}min(e,t){return new q({...this._def,minLength:{value:e,message:b.toString(t)}})}max(e,t){return new q({...this._def,maxLength:{value:e,message:b.toString(t)}})}length(e,t){return new q({...this._def,exactLength:{value:e,message:b.toString(t)}})}nonempty(e){return this.min(1,e)}}function J(e){if(e instanceof H){const t={};for(const a in e.shape){const s=e.shape[a];t[a]=he.create(J(s))}return new H({...e._def,shape:()=>t})}return e instanceof q?new q({...e._def,type:J(e.element)}):e instanceof he?he.create(J(e.unwrap())):e instanceof me?me.create(J(e.unwrap())):e instanceof te?te.create(e.items.map((e=>J(e)))):e}q.create=(e,t)=>new q({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ze.ZodArray,...Z(t)});class H extends T{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const t=this._def.shape(),a=e.objectKeys(t);return this._cached={shape:t,keys:a}}_parse(e){if(this._getType(e)!==n.object){const t=this._getOrReturnCtx(e);return p(t,{code:i.invalid_type,expected:n.object,received:t.parsedType}),m}const{status:t,ctx:a}=this._processInputParams(e),{shape:s,keys:r}=this._getCached(),o=[];if(!(this._def.catchall instanceof F&&"strip"===this._def.unknownKeys))for(const e in a.data)r.includes(e)||o.push(e);const d=[];for(const e of r){const t=s[e],n=a.data[e];d.push({key:{status:"valid",value:e},value:t._parse(new k(a,n,a.path,e)),alwaysSet:e in a.data})}if(this._def.catchall instanceof F){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of o)d.push({key:{status:"valid",value:e},value:{status:"valid",value:a.data[e]}});else if("strict"===e)o.length>0&&(p(a,{code:i.unrecognized_keys,keys:o}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of o){const s=a.data[t];d.push({key:{status:"valid",value:t},value:e._parse(new k(a,s,a.path,t)),alwaysSet:t in a.data})}}return a.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of d){const a=await t.key;e.push({key:a,value:await t.value,alwaysSet:t.alwaysSet})}return e})).then((e=>h.mergeObjectSync(t,e))):h.mergeObjectSync(t,d)}get shape(){return this._def.shape()}strict(e){return b.errToObj,new H({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,a)=>{var s,n,r,i;const o=null!==(r=null===(n=(s=this._def).errorMap)||void 0===n?void 0:n.call(s,t,a).message)&&void 0!==r?r:a.defaultError;return"unrecognized_keys"===t.code?{message:null!==(i=b.errToObj(e).message)&&void 0!==i?i:o}:{message:o}}}:{}})}strip(){return new H({...this._def,unknownKeys:"strip"})}passthrough(){return new H({...this._def,unknownKeys:"passthrough"})}extend(e){return new H({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new H({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ze.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new H({...this._def,catchall:e})}pick(t){const a={};return e.objectKeys(t).forEach((e=>{t[e]&&this.shape[e]&&(a[e]=this.shape[e])})),new H({...this._def,shape:()=>a})}omit(t){const a={};return e.objectKeys(this.shape).forEach((e=>{t[e]||(a[e]=this.shape[e])})),new H({...this._def,shape:()=>a})}deepPartial(){return J(this)}partial(t){const a={};return e.objectKeys(this.shape).forEach((e=>{const s=this.shape[e];t&&!t[e]?a[e]=s:a[e]=s.optional()})),new H({...this._def,shape:()=>a})}required(t){const a={};return e.objectKeys(this.shape).forEach((e=>{if(t&&!t[e])a[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof he;)t=t._def.innerType;a[e]=t}})),new H({...this._def,shape:()=>a})}keyof(){return de(e.objectKeys(this.shape))}}H.create=(e,t)=>new H({shape:()=>e,unknownKeys:"strip",catchall:F.create(),typeName:Ze.ZodObject,...Z(t)}),H.strictCreate=(e,t)=>new H({shape:()=>e,unknownKeys:"strict",catchall:F.create(),typeName:Ze.ZodObject,...Z(t)}),H.lazycreate=(e,t)=>new H({shape:e,unknownKeys:"strip",catchall:F.create(),typeName:Ze.ZodObject,...Z(t)});class Y extends T{_parse(e){const{ctx:t}=this._processInputParams(e),a=this._def.options;if(t.common.async)return Promise.all(a.map((async e=>{const a={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const a of e)if("dirty"===a.result.status)return t.common.issues.push(...a.ctx.common.issues),a.result;const a=e.map((e=>new o(e.ctx.common.issues)));return p(t,{code:i.invalid_union,unionErrors:a}),m}));{let e;const s=[];for(const n of a){const a={...t,common:{...t.common,issues:[]},parent:null},r=n._parseSync({data:t.data,path:t.path,parent:a});if("valid"===r.status)return r;"dirty"!==r.status||e||(e={result:r,ctx:a}),a.common.issues.length&&s.push(a.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const n=s.map((e=>new o(e)));return p(t,{code:i.invalid_union,unionErrors:n}),m}}get options(){return this._def.options}}Y.create=(e,t)=>new Y({options:e,typeName:Ze.ZodUnion,...Z(t)});const G=e=>e instanceof ie?G(e.schema):e instanceof pe?G(e.innerType()):e instanceof oe?[e.value]:e instanceof ce?e.options:e instanceof ue?Object.keys(e.enum):e instanceof fe?G(e._def.innerType):e instanceof U?[void 0]:e instanceof V?[null]:null;class X extends T{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==n.object)return p(t,{code:i.invalid_type,expected:n.object,received:t.parsedType}),m;const a=this.discriminator,s=t.data[a],r=this.optionsMap.get(s);return r?t.common.async?r._parseAsync({data:t.data,path:t.path,parent:t}):r._parseSync({data:t.data,path:t.path,parent:t}):(p(t,{code:i.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),m)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,a){const s=new Map;for(const a of t){const t=G(a.shape[e]);if(!t)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const n of t){if(s.has(n))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(n)}`);s.set(n,a)}}return new X({typeName:Ze.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...Z(a)})}}function Q(t,a){const s=r(t),i=r(a);if(t===a)return{valid:!0,data:t};if(s===n.object&&i===n.object){const s=e.objectKeys(a),n=e.objectKeys(t).filter((e=>-1!==s.indexOf(e))),r={...t,...a};for(const e of n){const s=Q(t[e],a[e]);if(!s.valid)return{valid:!1};r[e]=s.data}return{valid:!0,data:r}}if(s===n.array&&i===n.array){if(t.length!==a.length)return{valid:!1};const e=[];for(let s=0;s{if(_(e)||_(s))return m;const n=Q(e.value,s.value);return n.valid?((v(e)||v(s))&&t.dirty(),{status:t.value,value:n.data}):(p(a,{code:i.invalid_intersection_types}),m)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then((([e,t])=>s(e,t))):s(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}}ee.create=(e,t,a)=>new ee({left:e,right:t,typeName:Ze.ZodIntersection,...Z(a)});class te extends T{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==n.array)return p(a,{code:i.invalid_type,expected:n.array,received:a.parsedType}),m;if(a.data.lengththis._def.items.length&&(p(a,{code:i.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const s=[...a.data].map(((e,t)=>{const s=this._def.items[t]||this._def.rest;return s?s._parse(new k(a,e,a.path,t)):null})).filter((e=>!!e));return a.common.async?Promise.all(s).then((e=>h.mergeArray(t,e))):h.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new te({...this._def,rest:e})}}te.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new te({items:e,typeName:Ze.ZodTuple,rest:null,...Z(t)})};class ae extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==n.object)return p(a,{code:i.invalid_type,expected:n.object,received:a.parsedType}),m;const s=[],r=this._def.keyType,o=this._def.valueType;for(const e in a.data)s.push({key:r._parse(new k(a,e,a.path,e)),value:o._parse(new k(a,a.data[e],a.path,e))});return a.common.async?h.mergeObjectAsync(t,s):h.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,a){return new ae(t instanceof T?{keyType:e,valueType:t,typeName:Ze.ZodRecord,...Z(a)}:{keyType:R.create(),valueType:e,typeName:Ze.ZodRecord,...Z(t)})}}class se extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==n.map)return p(a,{code:i.invalid_type,expected:n.map,received:a.parsedType}),m;const s=this._def.keyType,r=this._def.valueType,o=[...a.data.entries()].map((([e,t],n)=>({key:s._parse(new k(a,e,a.path,[n,"key"])),value:r._parse(new k(a,t,a.path,[n,"value"]))})));if(a.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const a of o){const s=await a.key,n=await a.value;if("aborted"===s.status||"aborted"===n.status)return m;"dirty"!==s.status&&"dirty"!==n.status||t.dirty(),e.set(s.value,n.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const a of o){const s=a.key,n=a.value;if("aborted"===s.status||"aborted"===n.status)return m;"dirty"!==s.status&&"dirty"!==n.status||t.dirty(),e.set(s.value,n.value)}return{status:t.value,value:e}}}}se.create=(e,t,a)=>new se({valueType:t,keyType:e,typeName:Ze.ZodMap,...Z(a)});class ne extends T{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==n.set)return p(a,{code:i.invalid_type,expected:n.set,received:a.parsedType}),m;const s=this._def;null!==s.minSize&&a.data.sizes.maxSize.value&&(p(a,{code:i.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const r=this._def.valueType;function o(e){const a=new Set;for(const s of e){if("aborted"===s.status)return m;"dirty"===s.status&&t.dirty(),a.add(s.value)}return{status:t.value,value:a}}const d=[...a.data.values()].map(((e,t)=>r._parse(new k(a,e,a.path,t))));return a.common.async?Promise.all(d).then((e=>o(e))):o(d)}min(e,t){return new ne({...this._def,minSize:{value:e,message:b.toString(t)}})}max(e,t){return new ne({...this._def,maxSize:{value:e,message:b.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}ne.create=(e,t)=>new ne({valueType:e,minSize:null,maxSize:null,typeName:Ze.ZodSet,...Z(t)});class re extends T{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==n.function)return p(t,{code:i.invalid_type,expected:n.function,received:t.parsedType}),m;function a(e,a){return l({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,u(),d].filter((e=>!!e)),issueData:{code:i.invalid_arguments,argumentsError:a}})}function s(e,a){return l({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,u(),d].filter((e=>!!e)),issueData:{code:i.invalid_return_type,returnTypeError:a}})}const r={errorMap:t.common.contextualErrorMap},c=t.data;if(this._def.returns instanceof le){const e=this;return y((async function(...t){const n=new o([]),i=await e._def.args.parseAsync(t,r).catch((e=>{throw n.addIssue(a(t,e)),n})),d=await Reflect.apply(c,this,i);return await e._def.returns._def.type.parseAsync(d,r).catch((e=>{throw n.addIssue(s(d,e)),n}))}))}{const e=this;return y((function(...t){const n=e._def.args.safeParse(t,r);if(!n.success)throw new o([a(t,n.error)]);const i=Reflect.apply(c,this,n.data),d=e._def.returns.safeParse(i,r);if(!d.success)throw new o([s(i,d.error)]);return d.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new re({...this._def,args:te.create(e).rest(B.create())})}returns(e){return new re({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,a){return new re({args:e||te.create([]).rest(B.create()),returns:t||B.create(),typeName:Ze.ZodFunction,...Z(a)})}}class ie extends T{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}ie.create=(e,t)=>new ie({getter:e,typeName:Ze.ZodLazy,...Z(t)});class oe extends T{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return p(t,{received:t.data,code:i.invalid_literal,expected:this._def.value}),m}return{status:"valid",value:e.data}}get value(){return this._def.value}}function de(e,t){return new ce({values:e,typeName:Ze.ZodEnum,...Z(t)})}oe.create=(e,t)=>new oe({value:e,typeName:Ze.ZodLiteral,...Z(t)});class ce extends T{_parse(t){if("string"!=typeof t.data){const a=this._getOrReturnCtx(t),s=this._def.values;return p(a,{expected:e.joinValues(s),received:a.parsedType,code:i.invalid_type}),m}if(-1===this._def.values.indexOf(t.data)){const e=this._getOrReturnCtx(t),a=this._def.values;return p(e,{received:e.data,code:i.invalid_enum_value,options:a}),m}return y(t.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e){return ce.create(e)}exclude(e){return ce.create(this.options.filter((t=>!e.includes(t))))}}ce.create=de;class ue extends T{_parse(t){const a=e.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(t);if(s.parsedType!==n.string&&s.parsedType!==n.number){const t=e.objectValues(a);return p(s,{expected:e.joinValues(t),received:s.parsedType,code:i.invalid_type}),m}if(-1===a.indexOf(t.data)){const t=e.objectValues(a);return p(s,{received:s.data,code:i.invalid_enum_value,options:t}),m}return y(t.data)}get enum(){return this._def.values}}ue.create=(e,t)=>new ue({values:e,typeName:Ze.ZodNativeEnum,...Z(t)});class le extends T{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==n.promise&&!1===t.common.async)return p(t,{code:i.invalid_type,expected:n.promise,received:t.parsedType}),m;const a=t.parsedType===n.promise?t.data:Promise.resolve(t.data);return y(a.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}le.create=(e,t)=>new le({type:e,typeName:Ze.ZodPromise,...Z(t)});class pe extends T{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ze.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:a,ctx:s}=this._processInputParams(t),n=this._def.effect||null,r={addIssue:e=>{p(s,e),e.fatal?a.abort():a.dirty()},get path(){return s.path}};if(r.addIssue=r.addIssue.bind(r),"preprocess"===n.type){const e=n.transform(s.data,r);return s.common.issues.length?{status:"dirty",value:s.data}:s.common.async?Promise.resolve(e).then((e=>this._def.schema._parseAsync({data:e,path:s.path,parent:s}))):this._def.schema._parseSync({data:e,path:s.path,parent:s})}if("refinement"===n.type){const e=e=>{const t=n.refinement(e,r);if(s.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===s.common.async){const t=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return"aborted"===t.status?m:("dirty"===t.status&&a.dirty(),e(t.value),{status:a.value,value:t.value})}return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then((t=>"aborted"===t.status?m:("dirty"===t.status&&a.dirty(),e(t.value).then((()=>({status:a.value,value:t.value}))))))}if("transform"===n.type){if(!1===s.common.async){const e=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!g(e))return e;const t=n.transform(e.value,r);if(t instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:a.value,value:t}}return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then((e=>g(e)?Promise.resolve(n.transform(e.value,r)).then((e=>({status:a.value,value:e}))):e))}e.assertNever(n)}}pe.create=(e,t,a)=>new pe({schema:e,typeName:Ze.ZodEffects,effect:t,...Z(a)}),pe.createWithPreprocess=(e,t,a)=>new pe({schema:t,effect:{type:"preprocess",transform:e},typeName:Ze.ZodEffects,...Z(a)});class he extends T{_parse(e){return this._getType(e)===n.undefined?y(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}he.create=(e,t)=>new he({innerType:e,typeName:Ze.ZodOptional,...Z(t)});class me extends T{_parse(e){return this._getType(e)===n.null?y(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}me.create=(e,t)=>new me({innerType:e,typeName:Ze.ZodNullable,...Z(t)});class fe extends T{_parse(e){const{ctx:t}=this._processInputParams(e);let a=t.data;return t.parsedType===n.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}fe.create=(e,t)=>new fe({innerType:e,typeName:Ze.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...Z(t)});class ye extends T{_parse(e){const{ctx:t}=this._processInputParams(e),a={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return x(s)?s.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new o(a.common.issues)},input:a.data})}))):{status:"valid",value:"valid"===s.status?s.value:this._def.catchValue({get error(){return new o(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}}ye.create=(e,t)=>new ye({innerType:e,typeName:Ze.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...Z(t)});class _e extends T{_parse(e){if(this._getType(e)!==n.nan){const t=this._getOrReturnCtx(e);return p(t,{code:i.invalid_type,expected:n.nan,received:t.parsedType}),m}return{status:"valid",value:e.data}}}_e.create=e=>new _e({typeName:Ze.ZodNaN,...Z(e)});const ve=Symbol("zod_brand");class ge extends T{_parse(e){const{ctx:t}=this._processInputParams(e),a=t.data;return this._def.type._parse({data:a,path:t.path,parent:t})}unwrap(){return this._def.type}}class xe extends T{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return"aborted"===e.status?m:"dirty"===e.status?(t.dirty(),f(e.value)):this._def.out._parseAsync({data:e.value,path:a.path,parent:a})})();{const e=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===e.status?m:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:a.path,parent:a})}}static create(e,t){return new xe({in:e,out:t,typeName:Ze.ZodPipeline})}}class be extends T{_parse(e){const t=this._def.innerType._parse(e);return g(t)&&(t.value=Object.freeze(t.value)),t}}be.create=(e,t)=>new be({innerType:e,typeName:Ze.ZodReadonly,...Z(t)});const ke=(e,t={},a)=>e?K.create().superRefine(((s,n)=>{var r,i;if(!e(s)){const e="function"==typeof t?t(s):"string"==typeof t?{message:t}:t,o=null===(i=null!==(r=e.fatal)&&void 0!==r?r:a)||void 0===i||i,d="string"==typeof e?{message:e}:e;n.addIssue({code:"custom",...d,fatal:o})}})):K.create(),we={object:H.lazycreate};var Ze;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Ze||(Ze={}));const Te=R.create,Oe=M.create,Se=_e.create,Ne=$.create,Ce=L.create,je=D.create,Ee=z.create,Ie=U.create,Pe=V.create,Re=K.create,Ae=B.create,Me=F.create,$e=W.create,Le=q.create,De=H.create,ze=H.strictCreate,Ue=Y.create,Ve=X.create,Ke=ee.create,Be=te.create,Fe=ae.create,We=se.create,qe=ne.create,Je=re.create,He=ie.create,Ye=oe.create,Ge=ce.create,Xe=ue.create,Qe=le.create,et=pe.create,tt=he.create,at=me.create,st=pe.createWithPreprocess,nt=xe.create,rt={string:e=>R.create({...e,coerce:!0}),number:e=>M.create({...e,coerce:!0}),boolean:e=>L.create({...e,coerce:!0}),bigint:e=>$.create({...e,coerce:!0}),date:e=>D.create({...e,coerce:!0})},it=m;var ot=Object.freeze({__proto__:null,defaultErrorMap:d,setErrorMap:function(e){c=e},getErrorMap:u,makeIssue:l,EMPTY_PATH:[],addIssueToContext:p,ParseStatus:h,INVALID:m,DIRTY:f,OK:y,isAborted:_,isDirty:v,isValid:g,isAsync:x,get util(){return e},get objectUtil(){return t},ZodParsedType:n,getParsedType:r,ZodType:T,ZodString:R,ZodNumber:M,ZodBigInt:$,ZodBoolean:L,ZodDate:D,ZodSymbol:z,ZodUndefined:U,ZodNull:V,ZodAny:K,ZodUnknown:B,ZodNever:F,ZodVoid:W,ZodArray:q,ZodObject:H,ZodUnion:Y,ZodDiscriminatedUnion:X,ZodIntersection:ee,ZodTuple:te,ZodRecord:ae,ZodMap:se,ZodSet:ne,ZodFunction:re,ZodLazy:ie,ZodLiteral:oe,ZodEnum:ce,ZodNativeEnum:ue,ZodPromise:le,ZodEffects:pe,ZodTransformer:pe,ZodOptional:he,ZodNullable:me,ZodDefault:fe,ZodCatch:ye,ZodNaN:_e,BRAND:ve,ZodBranded:ge,ZodPipeline:xe,ZodReadonly:be,custom:ke,Schema:T,ZodSchema:T,late:we,get ZodFirstPartyTypeKind(){return Ze},coerce:rt,any:Re,array:Le,bigint:Ne,boolean:Ce,date:je,discriminatedUnion:Ve,effect:et,enum:Ge,function:Je,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>ke((t=>t instanceof e),t),intersection:Ke,lazy:He,literal:Ye,map:We,nan:Se,nativeEnum:Xe,never:Me,null:Pe,nullable:at,number:Oe,object:De,oboolean:()=>Ce().optional(),onumber:()=>Oe().optional(),optional:tt,ostring:()=>Te().optional(),pipeline:nt,preprocess:st,promise:Qe,record:Fe,set:qe,strictObject:ze,string:Te,symbol:Ee,transformer:et,tuple:Be,undefined:Ie,union:Ue,unknown:Ae,void:$e,NEVER:it,ZodIssueCode:i,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:o});const dt=require("benchmark");var ct=new(a.n(dt)().Suite);const ut={};ct.on("complete",(function(){const e=ct.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ut[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),ct.add("Check an invalid model with Zod typecheck",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=ot.object({id:ot.number(),name:ot.string(),age:ot.number(),isHappy:ot.boolean(),createdAt:ot.date(),updatedAt:ot.date().nullable(),favoriteColors:ot.array(ot.string()),favoriteNumbers:ot.array(ot.number()),favoriteFoods:ot.array(ot.object({name:ot.string(),calories:ot.number()}))}),a={id:1,name:"John"};try{t.parse(a)}catch(e){return}var s,n;s="Check an invalid model with Zod typecheck",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ut[s]?ut[s]=Math.max(ut[s],n):ut[s]=n})),ct.on("cycle",(function(e){console.log(String(e.target))})),ct.run(),module.exports.suite=s})(); \ No newline at end of file diff --git a/build/check-an-invalid-model-with-zod-typecheck-web-bundle.js b/build/check-an-invalid-model-with-zod-typecheck-web-bundle.js new file mode 100644 index 0000000..b1b01bc --- /dev/null +++ b/build/check-an-invalid-model-with-zod-typecheck-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see check-an-invalid-model-with-zod-typecheck-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var a,o={function:!0,object:!0},s=o[typeof window]&&window||this,u=(n.amdD,o[typeof t]&&t&&!t.nodeType&&t),c=o.object&&e&&!e.nodeType&&e,l=u&&c&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(s=l);var f=0,d=(c&&c.exports,/^(?:boolean|number|string|undefined)$/),p=0,h=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],m={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},g={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function _(e){var t=e&&e._||Y("lodash")||s._;if(!t)return W.runInContext=_,W;(e=e?t.defaults(s.Object(),e,t.pick(s,h)):s).Array;var r=e.Date,i=e.Function,o=e.Math,c=e.Object,l=(e.RegExp,e.String),y=[],b=c.prototype,x=o.abs,w=e.clearTimeout,k=o.floor,S=(o.log,o.max),O=o.min,T=o.pow,E=y.push,j=(e.setTimeout,y.shift),C=y.slice,A=o.sqrt,Z=(b.toString,y.unshift),I=Y,R=H(e,"document")&&e.document,N=I("microtime"),P=H(e,"process")&&e.process,M=R&&R.createElement("div"),$="uid"+t.now(),z={},B={};!function(){B.browser=R&&H(e,"navigator")&&!H(e,"phantom"),B.timeout=H(e,"setTimeout")&&H(e,"clearTimeout");try{B.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){B.decompilation=!1}}();var L={ns:r,start:null,stop:null};function W(e,n,r){var i=this;if(!(i instanceof W))return new W(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=V(i.stats),i.times=V(i.times)}function D(e){var t=this;if(!(t instanceof D))return new D(e);t.benchmark=e,ce(t)}function F(e){return e instanceof F?e:this instanceof F?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new F(e)}function U(e,n){var r=this;if(!(r instanceof U))return new U(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var V=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function K(){return K=function(e,t){var r,i=n.amdD?n.amdO:W,a=$+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+a+"=function("+e+"){"+t+"}"),r=i[a],delete i[a],r},(K=B.browser&&(K("",'return"'+$+'"')||t.noop)()==$?K:i).apply(null,arguments)}function q(e,n){e._timerId=t.delay(n,1e3*e.delay)}function G(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return J(e)?n=l(e):B.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function H(e,t){if(null==e)return!1;var n=typeof e[t];return!(d.test(n)||"object"==n&&!e[t])}function J(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function Y(e){try{var t=u&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:W,r=R.createElement("script"),i=R.getElementsByTagName("script")[0],a=i.parentNode,o=$+"runScript",s="("+(n.amdD?"define.amd.":"Benchmark.")+o+"||function(){})();";try{r.appendChild(R.createTextNode(s+e)),t[o]=function(){var e;e=r,M.appendChild(e),M.innerHTML=""}}catch(t){a=a.cloneNode(!1),i=null,r.text=e}a.insertBefore(r,i),delete t[o]}function ee(e,n){n=e.options=t.assign({},V(e.constructor.options),V(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=V(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=l(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,o,s=-1,u={currentTarget:e},c={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},l=t.toArray(e);function f(){var e,o=p(i);return o&&(i.on("complete",d),(e=i.events.complete).splice(0,0,e.pop())),l[s]=t.isFunction(i&&i[n])?i[n].apply(i,r):a,!o&&d()}function d(t){var n,r=i,a=p(r);if(a&&(r.off("complete",d),r.emit("complete")),u.type="cycle",u.target=r,n=F(u),c.onCycle.call(e,n),n.aborted||!1===h())u.type="complete",c.onComplete.call(e,F(u));else if(p(i=o?e[0]:l[s]))q(i,f);else{if(!a)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function p(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof W&&((null==t?e.options.async:t)&&B.timeout||e.defer)}function h(){return s++,o&&s>0&&j.call(e),(o?e.length:s>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(o?e:t+r+e)})),i.join(n||",")}function ae(e){var n,r=this,i=F(e),a=r.events,o=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,a&&(n=t.has(a,i.type)&&a[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,o))&&(i.cancelled=!0),!i.aborted})),i.result}function oe(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function se(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var a;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(a=t.indexOf(e,n))>-1&&e.splice(a,1):e.length=0)})),r):r}function ue(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function ce(){var n=W.options,r={},i=[{ns:L.ns,res:S(.0015,o("ms")),unit:"ms"}];function a(e,n,i,a){var o=e.fn,u=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(o)||"deferred":"";return r.uid=$+p++,t.assign(r,{setup:n?X(e.setup):s("m#.setup()"),fn:n?X(o):s("m#.fn("+u+")"),fnArg:u,teardown:n?X(e.teardown):s("m#.teardown()")}),"ns"==L.unit?t.assign(r,{begin:s("s#=n#()"),end:s("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==L.unit?L.ns.stop?t.assign(r,{begin:s("s#=n#.start()"),end:s("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:s("s#=n#()"),end:s("r#=(n#()-s#)/1e6")}):L.ns.now?t.assign(r,{begin:s("s#=n#.now()"),end:s("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:s("s#=new n#().getTime()"),end:s("r#=(new n#().getTime()-s#)/1e3")}),L.start=K(s("o#"),s("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),L.stop=K(s("o#"),s("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),K(s("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+s(a))}function o(e){for(var t,n,r=30,i=1e3,a=L.ns,o=[];r--;){if("us"==e)if(i=1e6,a.stop)for(a.start();!(t=a.microseconds()););else for(n=a();!(t=a()-n););else if("ns"==e){for(i=1e9,n=(n=a())[0]+n[1]/i;!(t=(t=a())[0]+t[1]/i-n););i=1}else if(a.now)for(n=a.now();!(t=a.now()-n););else for(n=(new a).getTime();!(t=(new a).getTime()-n););if(!(t>0)){o.push(1/0);break}o.push(t)}return G(o)/i}function s(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}ce=function(i){var o;i instanceof D&&(i=(o=i).benchmark);var s=i._original,u=J(s.fn),c=s.count=i.count,f=u||B.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),d=s.id,p=s.name||("number"==typeof d?"":d),h=0;i.minTime=s.minTime||(s.minTime=s.options.minTime=n.minTime);var m=o?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=s.compiled=i.compiled=a(s,f,o,m),g=!(r.fn||u);try{if(g)throw new Error('The test "'+p+'" is empty. This may be the result of dead code removal.');o||(s.count=1,v=f&&(v.call(s,e,L)||{}).uid==r.uid&&v,s.count=c)}catch(e){v=null,i.error=e||new Error(l(e)),s.count=c}if(!v&&!o&&!g){v=a(s,f,o,m=(u||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{s.count=1,v.call(s,e,L),s.count=c,delete i.error}catch(e){s.count=c,i.error||(i.error=e||new Error(l(e)))}}return i.error||(h=(v=s.compiled=i.compiled=a(s,f,o,m)).call(o||s,e,L).elapsed),h};try{(L.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:L.ns,res:o("us"),unit:"us"})}catch(e){}if(P&&"function"==typeof(L.ns=P.hrtime)&&i.push({ns:L.ns,res:o("ns"),unit:"ns"}),N&&"function"==typeof(L.ns=N.now)&&i.push({ns:L.ns,res:o("us"),unit:"us"}),(L=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=S(L.res/2/.01,.05)),ce.apply(null,arguments)}function le(t,n){var r;n||(n={}),t instanceof D&&(r=t,t=t.benchmark);var i,a,s,u,c,l,f=n.async,d=t._original,p=t.count,h=t.times;t.running&&(a=++t.cycles,i=r?r.elapsed:ce(t),c=t.minTime,a>d.cycles&&(d.cycles=a),t.error&&((u=F("error")).message=t.error,t.emit(u),u.cancelled||t.abort())),t.running&&(d.times.cycle=h.cycle=i,l=d.times.period=h.period=i/p,d.hz=t.hz=1/l,d.initCount=t.initCount=p,t.running=ie?0:n30?(n=function(e){return(e-a*o/2)/A(a*o*(a+o+1)/12)}(f),x(n)>1.96?f==c?1:-1:0):f<=(s<5||u<3?0:g[s][u-3])?f==c?1:-1:0},emit:ae,listeners:oe,off:se,on:ue,reset:function(){var e=this;if(e.running&&!z.abort)return z.reset=!0,e.abort(),delete z.reset,e;var n,r=0,i=[],o=[],s={destination:e,source:t.assign({},V(e.constructor.prototype),V(e.options))};do{t.forOwn(s.source,(function(e,n){var r,u=s.destination,c=u[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(c)||(r=!0,c=[]),c.length!=e.length&&(r=!0,(c=c.slice(0,e.length)).length=e.length)):t.isObjectLike(c)||(r=!0,c={}),r&&i.push({destination:u,key:n,value:c}),o.push({destination:c,source:e})):t.eq(c,e)||e===a||i.push({destination:u,key:n,value:e}))}))}while(s=o[r++]);return i.length&&(e.emit(n=F("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=F("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&B.timeout},n._original?n.defer?D(n):le(n,e):function(e,n){n||(n={});var r=n.async,i=0,a=e.initCount,s=e.minSamples,u=[],c=e.stats.sample;function l(){u.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}l(),re(u,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,d,p,h,m,g,_=n.target,y=e.aborted,b=t.now(),x=c.push(_.times.period),w=x>=s&&(i+=b-_.times.timeStamp)/1e3>e.maxTime,k=e.times;(y||_.hz==1/0)&&(w=!(x=c.length=u.length=0)),y||(f=G(c),g=t.reduce(c,(function(e,t){return e+T(t-f,2)}),0)/(x-1)||0,r=x-1,p=(d=(m=(h=A(g))/A(x))*(v[o.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:h,mean:f,moe:d,rme:p,sem:m,variance:g}),w&&(e.initCount=a,e.running=!1,y=!0,k.elapsed=(b-k.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,k.cycle=f*e.count,k.period=f)),u.length<2&&!w&&l(),n.aborted=y},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,a=e.stats,o=a.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):l(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+a.rme.toFixed(2)+"% ("+o+" run"+(1==o?"":"s")+" sampled)")}}),t.assign(D.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(D.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,le(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,a="Expected a function",o="__lodash_hash_undefined__",s="__lodash_placeholder__",u=32,c=128,l=1/0,f=9007199254740991,d=NaN,p=4294967295,h=[["ary",c],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",u],["partialRight",64],["rearg",256]],m="[object Arguments]",v="[object Array]",g="[object Boolean]",_="[object Date]",y="[object Error]",b="[object Function]",x="[object GeneratorFunction]",w="[object Map]",k="[object Number]",S="[object Object]",O="[object Promise]",T="[object RegExp]",E="[object Set]",j="[object String]",C="[object Symbol]",A="[object WeakMap]",Z="[object ArrayBuffer]",I="[object DataView]",R="[object Float32Array]",N="[object Float64Array]",P="[object Int8Array]",M="[object Int16Array]",$="[object Int32Array]",z="[object Uint8Array]",B="[object Uint8ClampedArray]",L="[object Uint16Array]",W="[object Uint32Array]",D=/\b__p \+= '';/g,F=/\b(__p \+=) '' \+/g,U=/(__e\(.*?\)|\b__t\)) \+\n'';/g,V=/&(?:amp|lt|gt|quot|#39);/g,K=/[&<>"']/g,q=RegExp(V.source),G=RegExp(K.source),X=/<%-([\s\S]+?)%>/g,H=/<%([\s\S]+?)%>/g,J=/<%=([\s\S]+?)%>/g,Y=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,ae=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,oe=/\{\n\/\* \[wrapped with (.+)\] \*/,se=/,? & /,ue=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ce=/[()=,{}\[\]\/\s]/,le=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,de=/\w*$/,pe=/^[-+]0x[0-9a-f]+$/i,he=/^0b[01]+$/i,me=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ge=/^(?:0|[1-9]\d*)$/,_e=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ye=/($^)/,be=/['\n\r\u2028\u2029\\]/g,xe="\\ud800-\\udfff",we="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",ke="\\u2700-\\u27bf",Se="a-z\\xdf-\\xf6\\xf8-\\xff",Oe="A-Z\\xc0-\\xd6\\xd8-\\xde",Te="\\ufe0e\\ufe0f",Ee="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",je="["+xe+"]",Ce="["+Ee+"]",Ae="["+we+"]",Ze="\\d+",Ie="["+ke+"]",Re="["+Se+"]",Ne="[^"+xe+Ee+Ze+ke+Se+Oe+"]",Pe="\\ud83c[\\udffb-\\udfff]",Me="[^"+xe+"]",$e="(?:\\ud83c[\\udde6-\\uddff]){2}",ze="[\\ud800-\\udbff][\\udc00-\\udfff]",Be="["+Oe+"]",Le="\\u200d",We="(?:"+Re+"|"+Ne+")",De="(?:"+Be+"|"+Ne+")",Fe="(?:['’](?:d|ll|m|re|s|t|ve))?",Ue="(?:['’](?:D|LL|M|RE|S|T|VE))?",Ve="(?:"+Ae+"|"+Pe+")?",Ke="["+Te+"]?",qe=Ke+Ve+"(?:"+Le+"(?:"+[Me,$e,ze].join("|")+")"+Ke+Ve+")*",Ge="(?:"+[Ie,$e,ze].join("|")+")"+qe,Xe="(?:"+[Me+Ae+"?",Ae,$e,ze,je].join("|")+")",He=RegExp("['’]","g"),Je=RegExp(Ae,"g"),Ye=RegExp(Pe+"(?="+Pe+")|"+Xe+qe,"g"),Qe=RegExp([Be+"?"+Re+"+"+Fe+"(?="+[Ce,Be,"$"].join("|")+")",De+"+"+Ue+"(?="+[Ce,Be+We,"$"].join("|")+")",Be+"?"+We+"+"+Fe,Be+"+"+Ue,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ze,Ge].join("|"),"g"),et=RegExp("["+Le+xe+we+Te+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[R]=it[N]=it[P]=it[M]=it[$]=it[z]=it[B]=it[L]=it[W]=!0,it[m]=it[v]=it[Z]=it[g]=it[I]=it[_]=it[y]=it[b]=it[w]=it[k]=it[S]=it[T]=it[E]=it[j]=it[A]=!1;var at={};at[m]=at[v]=at[Z]=at[I]=at[g]=at[_]=at[R]=at[N]=at[P]=at[M]=at[$]=at[w]=at[k]=at[S]=at[T]=at[E]=at[j]=at[C]=at[z]=at[B]=at[L]=at[W]=!0,at[y]=at[b]=at[A]=!1;var ot={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},st=parseFloat,ut=parseInt,ct="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,lt="object"==typeof self&&self&&self.Object===Object&&self,ft=ct||lt||Function("return this")(),dt=t&&!t.nodeType&&t,pt=dt&&e&&!e.nodeType&&e,ht=pt&&pt.exports===dt,mt=ht&&ct.process,vt=function(){try{return pt&&pt.require&&pt.require("util").types||mt&&mt.binding&&mt.binding("util")}catch(e){}}(),gt=vt&&vt.isArrayBuffer,_t=vt&&vt.isDate,yt=vt&&vt.isMap,bt=vt&&vt.isRegExp,xt=vt&&vt.isSet,wt=vt&&vt.isTypedArray;function kt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function St(e,t,n,r){for(var i=-1,a=null==e?0:e.length;++i-1}function At(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&Bt(t,e[n],0)>-1;);return n}var en=Ut({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=Ut({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+ot[e]}function rn(e){return et.test(e)}function an(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function on(e,t){return function(n){return e(t(n))}}function sn(e,t){for(var n=-1,r=e.length,i=0,a=[];++n",""":'"',"'":"'"}),hn=function e(t){var n,r=(t=null==t?ft:hn.defaults(ft.Object(),t,hn.pick(ft,nt))).Array,ie=t.Date,xe=t.Error,we=t.Function,ke=t.Math,Se=t.Object,Oe=t.RegExp,Te=t.String,Ee=t.TypeError,je=r.prototype,Ce=we.prototype,Ae=Se.prototype,Ze=t["__core-js_shared__"],Ie=Ce.toString,Re=Ae.hasOwnProperty,Ne=0,Pe=(n=/[^.]+$/.exec(Ze&&Ze.keys&&Ze.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Me=Ae.toString,$e=Ie.call(Se),ze=ft._,Be=Oe("^"+Ie.call(Re).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Le=ht?t.Buffer:i,We=t.Symbol,De=t.Uint8Array,Fe=Le?Le.allocUnsafe:i,Ue=on(Se.getPrototypeOf,Se),Ve=Se.create,Ke=Ae.propertyIsEnumerable,qe=je.splice,Ge=We?We.isConcatSpreadable:i,Xe=We?We.iterator:i,Ye=We?We.toStringTag:i,et=function(){try{var e=ua(Se,"defineProperty");return e({},"",{}),e}catch(e){}}(),ot=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,ct=ie&&ie.now!==ft.Date.now&&ie.now,lt=t.setTimeout!==ft.setTimeout&&t.setTimeout,dt=ke.ceil,pt=ke.floor,mt=Se.getOwnPropertySymbols,vt=Le?Le.isBuffer:i,Mt=t.isFinite,Ut=je.join,mn=on(Se.keys,Se),vn=ke.max,gn=ke.min,_n=ie.now,yn=t.parseInt,bn=ke.random,xn=je.reverse,wn=ua(t,"DataView"),kn=ua(t,"Map"),Sn=ua(t,"Promise"),On=ua(t,"Set"),Tn=ua(t,"WeakMap"),En=ua(Se,"create"),jn=Tn&&new Tn,Cn={},An=Ma(wn),Zn=Ma(kn),In=Ma(Sn),Rn=Ma(On),Nn=Ma(Tn),Pn=We?We.prototype:i,Mn=Pn?Pn.valueOf:i,$n=Pn?Pn.toString:i;function zn(e){if(es(e)&&!Fo(e)&&!(e instanceof Dn)){if(e instanceof Wn)return e;if(Re.call(e,"__wrapped__"))return $a(e)}return new Wn(e)}var Bn=function(){function e(){}return function(t){if(!Qo(t))return{};if(Ve)return Ve(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Ln(){}function Wn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Dn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=p,this.__views__=[]}function Fn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function or(e,t,n,r,a,o){var s,u=1&t,c=2&t,l=4&t;if(n&&(s=a?n(e,r,a,o):n(e)),s!==i)return s;if(!Qo(e))return e;var f=Fo(e);if(f){if(s=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Re.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!u)return Ti(e,s)}else{var d=fa(e),p=d==b||d==x;if(qo(e))return bi(e,u);if(d==S||d==m||p&&!a){if(s=c||p?{}:pa(e),!u)return c?function(e,t){return Ei(e,la(e),t)}(e,function(e,t){return e&&Ei(t,Zs(t),e)}(s,e)):function(e,t){return Ei(e,ca(e),t)}(e,nr(s,e))}else{if(!at[d])return a?e:{};s=function(e,t,n){var r,i=e.constructor;switch(t){case Z:return xi(e);case g:case _:return new i(+e);case I:return function(e,t){var n=t?xi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case R:case N:case P:case M:case $:case z:case B:case L:case W:return wi(e,n);case w:return new i;case k:case j:return new i(e);case T:return function(e){var t=new e.constructor(e.source,de.exec(e));return t.lastIndex=e.lastIndex,t}(e);case E:return new i;case C:return r=e,Mn?Se(Mn.call(r)):{}}}(e,d,u)}}o||(o=new qn);var h=o.get(e);if(h)return h;o.set(e,s),as(e)?e.forEach((function(r){s.add(or(r,t,n,r,e,o))})):ts(e)&&e.forEach((function(r,i){s.set(i,or(r,t,n,i,e,o))}));var v=f?i:(l?c?ta:ea:c?Zs:As)(e);return Ot(v||e,(function(r,i){v&&(r=e[i=r]),Qn(s,i,or(r,t,n,i,e,o))})),s}function sr(e,t,n){var r=n.length;if(null==e)return!r;for(e=Se(e);r--;){var a=n[r],o=t[a],s=e[a];if(s===i&&!(a in e)||!o(s))return!1}return!0}function ur(e,t,n){if("function"!=typeof e)throw new Ee(a);return Ea((function(){e.apply(i,n)}),t)}function cr(e,t,n,r){var i=-1,a=Ct,o=!0,s=e.length,u=[],c=t.length;if(!s)return u;n&&(t=Zt(t,Xt(n))),r?(a=At,o=!1):t.length>=200&&(a=Jt,o=!1,t=new Kn(t));e:for(;++i-1},Un.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Vn.prototype.clear=function(){this.size=0,this.__data__={hash:new Fn,map:new(kn||Un),string:new Fn}},Vn.prototype.delete=function(e){var t=oa(this,e).delete(e);return this.size-=t?1:0,t},Vn.prototype.get=function(e){return oa(this,e).get(e)},Vn.prototype.has=function(e){return oa(this,e).has(e)},Vn.prototype.set=function(e,t){var n=oa(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Kn.prototype.add=Kn.prototype.push=function(e){return this.__data__.set(e,o),this},Kn.prototype.has=function(e){return this.__data__.has(e)},qn.prototype.clear=function(){this.__data__=new Un,this.size=0},qn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},qn.prototype.get=function(e){return this.__data__.get(e)},qn.prototype.has=function(e){return this.__data__.has(e)},qn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Un){var r=n.__data__;if(!kn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Vn(r)}return n.set(e,t),this.size=n.size,this};var lr=Ai(_r),fr=Ai(yr,!0);function dr(e,t){var n=!0;return lr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function pr(e,t,n){for(var r=-1,a=e.length;++r0&&n(s)?t>1?mr(s,t-1,n,r,i):It(i,s):r||(i[i.length]=s)}return i}var vr=Zi(),gr=Zi(!0);function _r(e,t){return e&&vr(e,t,As)}function yr(e,t){return e&&gr(e,t,As)}function br(e,t){return jt(t,(function(t){return Ho(e[t])}))}function xr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Or(e,t){return null!=e&&Re.call(e,t)}function Tr(e,t){return null!=e&&t in Se(e)}function Er(e,t,n){for(var a=n?At:Ct,o=e[0].length,s=e.length,u=s,c=r(s),l=1/0,f=[];u--;){var d=e[u];u&&t&&(d=Zt(d,Xt(t))),l=gn(d.length,l),c[u]=!n&&(t||o>=120&&d.length>=120)?new Kn(u&&d):i}d=e[0];var p=-1,h=c[0];e:for(;++p=s?u:u*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Dr(e,t,n){for(var r=-1,i=t.length,a={};++r-1;)s!==e&&qe.call(s,u,1),qe.call(e,u,1);return e}function Ur(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==a){var a=i;ma(i)?qe.call(e,i,1):ui(e,i)}}return e}function Vr(e,t){return e+pt(bn()*(t-e+1))}function Kr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=pt(t/2))&&(e+=e)}while(t);return n}function qr(e,t){return ja(ka(e,t,nu),e+"")}function Gr(e){return Xn(Bs(e))}function Xr(e,t){var n=Bs(e);return Za(n,ar(t,0,n.length))}function Hr(e,t,n,r){if(!Qo(e))return e;for(var a=-1,o=(t=vi(t,e)).length,s=o-1,u=e;null!=u&&++aa?0:a+t),(n=n>a?a:n)<0&&(n+=a),a=t>n?0:n-t>>>0,t>>>=0;for(var o=r(a);++i>>1,o=e[a];null!==o&&!ss(o)&&(n?o<=t:o=200){var c=t?null:Ki(e);if(c)return un(c);o=!1,i=Jt,u=new Kn}else u=t?[]:s;e:for(;++r=r?e:ei(e,t,n)}var yi=ot||function(e){return ft.clearTimeout(e)};function bi(e,t){if(t)return e.slice();var n=e.length,r=Fe?Fe(n):new e.constructor(n);return e.copy(r),r}function xi(e){var t=new e.constructor(e.byteLength);return new De(t).set(new De(e)),t}function wi(e,t){var n=t?xi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ki(e,t){if(e!==t){var n=e!==i,r=null===e,a=e==e,o=ss(e),s=t!==i,u=null===t,c=t==t,l=ss(t);if(!u&&!l&&!o&&e>t||o&&s&&c&&!u&&!l||r&&s&&c||!n&&c||!a)return 1;if(!r&&!o&&!l&&e1?n[a-1]:i,s=a>2?n[2]:i;for(o=e.length>3&&"function"==typeof o?(a--,o):i,s&&va(n[0],n[1],s)&&(o=a<3?i:o,a=1),t=Se(t);++r-1?a[o?t[s]:s]:i}}function Mi(e){return Qi((function(t){var n=t.length,r=n,o=Wn.prototype.thru;for(e&&t.reverse();r--;){var s=t[r];if("function"!=typeof s)throw new Ee(a);if(o&&!u&&"wrapper"==ra(s))var u=new Wn([],!0)}for(r=u?r:n;++r1&&b.reverse(),p&&fu))return!1;var l=o.get(e),f=o.get(t);if(l&&f)return l==t&&f==e;var d=-1,p=!0,h=2&n?new Kn:i;for(o.set(e,t),o.set(t,e);++d-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(ae,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return Ot(h,(function(n){var r="_."+n[0];t&n[1]&&!Ct(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(oe);return t?t[1].split(se):[]}(r),n)))}function Aa(e){var t=0,n=0;return function(){var r=_n(),a=16-(r-n);if(n=r,a>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function Za(e,t){var n=-1,r=e.length,a=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ro(e,n)}));function lo(e){var t=zn(e);return t.__chain__=!0,t}function fo(e,t){return t(e)}var po=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,a=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Dn&&ma(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:fo,args:[a],thisArg:i}),new Wn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(a)})),ho=ji((function(e,t,n){Re.call(e,n)?++e[n]:rr(e,n,1)})),mo=Pi(Wa),vo=Pi(Da);function go(e,t){return(Fo(e)?Ot:lr)(e,aa(t,3))}function _o(e,t){return(Fo(e)?Tt:fr)(e,aa(t,3))}var yo=ji((function(e,t,n){Re.call(e,n)?e[n].push(t):rr(e,n,[t])})),bo=qr((function(e,t,n){var i=-1,a="function"==typeof t,o=Vo(e)?r(e.length):[];return lr(e,(function(e){o[++i]=a?kt(t,e,n):jr(e,t,n)})),o})),xo=ji((function(e,t,n){rr(e,n,t)}));function wo(e,t){return(Fo(e)?Zt:Mr)(e,aa(t,3))}var ko=ji((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),So=qr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&va(e,t[0],t[1])?t=[]:n>2&&va(t[0],t[1],t[2])&&(t=[t[0]]),Wr(e,mr(t,1),[])})),Oo=ct||function(){return ft.Date.now()};function To(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,Gi(e,c,i,i,i,i,t)}function Eo(e,t){var n;if("function"!=typeof t)throw new Ee(a);return e=ps(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var jo=qr((function(e,t,n){var r=1;if(n.length){var i=sn(n,ia(jo));r|=u}return Gi(e,r,t,n,i)})),Co=qr((function(e,t,n){var r=3;if(n.length){var i=sn(n,ia(Co));r|=u}return Gi(t,r,e,n,i)}));function Ao(e,t,n){var r,o,s,u,c,l,f=0,d=!1,p=!1,h=!0;if("function"!=typeof e)throw new Ee(a);function m(t){var n=r,a=o;return r=o=i,f=t,u=e.apply(a,n)}function v(e){var n=e-l;return l===i||n>=t||n<0||p&&e-f>=s}function g(){var e=Oo();if(v(e))return _(e);c=Ea(g,function(e){var n=t-(e-l);return p?gn(n,s-(e-f)):n}(e))}function _(e){return c=i,h&&r?m(e):(r=o=i,u)}function y(){var e=Oo(),n=v(e);if(r=arguments,o=this,l=e,n){if(c===i)return function(e){return f=e,c=Ea(g,t),d?m(e):u}(l);if(p)return yi(c),c=Ea(g,t),m(l)}return c===i&&(c=Ea(g,t)),u}return t=ms(t)||0,Qo(n)&&(d=!!n.leading,s=(p="maxWait"in n)?vn(ms(n.maxWait)||0,t):s,h="trailing"in n?!!n.trailing:h),y.cancel=function(){c!==i&&yi(c),f=0,r=l=o=c=i},y.flush=function(){return c===i?u:_(Oo())},y}var Zo=qr((function(e,t){return ur(e,1,t)})),Io=qr((function(e,t,n){return ur(e,ms(t)||0,n)}));function Ro(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Ee(a);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(Ro.Cache||Vn),n}function No(e){if("function"!=typeof e)throw new Ee(a);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Ro.Cache=Vn;var Po=gi((function(e,t){var n=(t=1==t.length&&Fo(t[0])?Zt(t[0],Xt(aa())):Zt(mr(t,1),Xt(aa()))).length;return qr((function(r){for(var i=-1,a=gn(r.length,n);++i=t})),Do=Cr(function(){return arguments}())?Cr:function(e){return es(e)&&Re.call(e,"callee")&&!Ke.call(e,"callee")},Fo=r.isArray,Uo=gt?Xt(gt):function(e){return es(e)&&kr(e)==Z};function Vo(e){return null!=e&&Yo(e.length)&&!Ho(e)}function Ko(e){return es(e)&&Vo(e)}var qo=vt||mu,Go=_t?Xt(_t):function(e){return es(e)&&kr(e)==_};function Xo(e){if(!es(e))return!1;var t=kr(e);return t==y||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!rs(e)}function Ho(e){if(!Qo(e))return!1;var t=kr(e);return t==b||t==x||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Jo(e){return"number"==typeof e&&e==ps(e)}function Yo(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qo(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function es(e){return null!=e&&"object"==typeof e}var ts=yt?Xt(yt):function(e){return es(e)&&fa(e)==w};function ns(e){return"number"==typeof e||es(e)&&kr(e)==k}function rs(e){if(!es(e)||kr(e)!=S)return!1;var t=Ue(e);if(null===t)return!0;var n=Re.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Ie.call(n)==$e}var is=bt?Xt(bt):function(e){return es(e)&&kr(e)==T},as=xt?Xt(xt):function(e){return es(e)&&fa(e)==E};function os(e){return"string"==typeof e||!Fo(e)&&es(e)&&kr(e)==j}function ss(e){return"symbol"==typeof e||es(e)&&kr(e)==C}var us=wt?Xt(wt):function(e){return es(e)&&Yo(e.length)&&!!it[kr(e)]},cs=Fi(Pr),ls=Fi((function(e,t){return e<=t}));function fs(e){if(!e)return[];if(Vo(e))return os(e)?fn(e):Ti(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fa(e);return(t==w?an:t==E?un:Bs)(e)}function ds(e){return e?(e=ms(e))===l||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function ps(e){var t=ds(e),n=t%1;return t==t?n?t-n:t:0}function hs(e){return e?ar(ps(e),0,p):0}function ms(e){if("number"==typeof e)return e;if(ss(e))return d;if(Qo(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qo(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Gt(e);var n=he.test(e);return n||ve.test(e)?ut(e.slice(2),n?2:8):pe.test(e)?d:+e}function vs(e){return Ei(e,Zs(e))}function gs(e){return null==e?"":oi(e)}var _s=Ci((function(e,t){if(ba(t)||Vo(t))Ei(t,As(t),e);else for(var n in t)Re.call(t,n)&&Qn(e,n,t[n])})),ys=Ci((function(e,t){Ei(t,Zs(t),e)})),bs=Ci((function(e,t,n,r){Ei(t,Zs(t),e,r)})),xs=Ci((function(e,t,n,r){Ei(t,As(t),e,r)})),ws=Qi(ir),ks=qr((function(e,t){e=Se(e);var n=-1,r=t.length,a=r>2?t[2]:i;for(a&&va(t[0],t[1],a)&&(r=1);++n1),t})),Ei(e,ta(e),n),r&&(n=or(n,7,Ji));for(var i=t.length;i--;)ui(n,t[i]);return n})),Ps=Qi((function(e,t){return null==e?{}:function(e,t){return Dr(e,t,(function(t,n){return Ts(e,n)}))}(e,t)}));function Ms(e,t){if(null==e)return{};var n=Zt(ta(e),(function(e){return[e]}));return t=aa(t),Dr(e,n,(function(e,n){return t(e,n[0])}))}var $s=qi(As),zs=qi(Zs);function Bs(e){return null==e?[]:Ht(e,As(e))}var Ls=Ri((function(e,t,n){return t=t.toLowerCase(),e+(n?Ws(t):t)}));function Ws(e){return Xs(gs(e).toLowerCase())}function Ds(e){return(e=gs(e))&&e.replace(_e,en).replace(Je,"")}var Fs=Ri((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),Us=Ri((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Vs=Ii("toLowerCase"),Ks=Ri((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),qs=Ri((function(e,t,n){return e+(n?" ":"")+Xs(t)})),Gs=Ri((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xs=Ii("toUpperCase");function Hs(e,t,n){return e=gs(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(ue)||[]}(e):e.match(t)||[]}var Js=qr((function(e,t){try{return kt(e,i,t)}catch(e){return Xo(e)?e:new xe(e)}})),Ys=Qi((function(e,t){return Ot(t,(function(t){t=Pa(t),rr(e,t,jo(e[t],e))})),e}));function Qs(e){return function(){return e}}var eu=Mi(),tu=Mi(!0);function nu(e){return e}function ru(e){return Rr("function"==typeof e?e:or(e,1))}var iu=qr((function(e,t){return function(n){return jr(n,e,t)}})),au=qr((function(e,t){return function(n){return jr(e,n,t)}}));function ou(e,t,n){var r=As(t),i=br(t,r);null!=n||Qo(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=br(t,As(t)));var a=!(Qo(n)&&"chain"in n&&!n.chain),o=Ho(e);return Ot(i,(function(n){var r=t[n];e[n]=r,o&&(e.prototype[n]=function(){var t=this.__chain__;if(a||t){var n=e(this.__wrapped__);return(n.__actions__=Ti(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,It([this.value()],arguments))})})),e}function su(){}var uu=Li(Zt),cu=Li(Et),lu=Li(Pt);function fu(e){return ga(e)?Ft(Pa(e)):function(e){return function(t){return xr(t,e)}}(e)}var du=Di(),pu=Di(!0);function hu(){return[]}function mu(){return!1}var vu,gu=Bi((function(e,t){return e+t}),0),_u=Vi("ceil"),yu=Bi((function(e,t){return e/t}),1),bu=Vi("floor"),xu=Bi((function(e,t){return e*t}),1),wu=Vi("round"),ku=Bi((function(e,t){return e-t}),0);return zn.after=function(e,t){if("function"!=typeof t)throw new Ee(a);return e=ps(e),function(){if(--e<1)return t.apply(this,arguments)}},zn.ary=To,zn.assign=_s,zn.assignIn=ys,zn.assignInWith=bs,zn.assignWith=xs,zn.at=ws,zn.before=Eo,zn.bind=jo,zn.bindAll=Ys,zn.bindKey=Co,zn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Fo(e)?e:[e]},zn.chain=lo,zn.chunk=function(e,t,n){t=(n?va(e,t,n):t===i)?1:vn(ps(t),0);var a=null==e?0:e.length;if(!a||t<1)return[];for(var o=0,s=0,u=r(dt(a/t));oa?0:a+n),(r=r===i||r>a?a:ps(r))<0&&(r+=a),r=n>r?0:hs(r);n>>0)?(e=gs(e))&&("string"==typeof t||null!=t&&!is(t))&&!(t=oi(t))&&rn(e)?_i(fn(e),0,n):e.split(t,n):[]},zn.spread=function(e,t){if("function"!=typeof e)throw new Ee(a);return t=null==t?0:vn(ps(t),0),qr((function(n){var r=n[t],i=_i(n,0,t);return r&&It(i,r),kt(e,this,i)}))},zn.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},zn.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:ps(t))<0?0:t):[]},zn.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:ps(t)))<0?0:t,r):[]},zn.takeRightWhile=function(e,t){return e&&e.length?li(e,aa(t,3),!1,!0):[]},zn.takeWhile=function(e,t){return e&&e.length?li(e,aa(t,3)):[]},zn.tap=function(e,t){return t(e),e},zn.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new Ee(a);return Qo(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ao(e,t,{leading:r,maxWait:t,trailing:i})},zn.thru=fo,zn.toArray=fs,zn.toPairs=$s,zn.toPairsIn=zs,zn.toPath=function(e){return Fo(e)?Zt(e,Pa):ss(e)?[e]:Ti(Na(gs(e)))},zn.toPlainObject=vs,zn.transform=function(e,t,n){var r=Fo(e),i=r||qo(e)||us(e);if(t=aa(t,4),null==n){var a=e&&e.constructor;n=i?r?new a:[]:Qo(e)&&Ho(a)?Bn(Ue(e)):{}}return(i?Ot:_r)(e,(function(e,r,i){return t(n,e,r,i)})),n},zn.unary=function(e){return To(e,1)},zn.union=Qa,zn.unionBy=eo,zn.unionWith=to,zn.uniq=function(e){return e&&e.length?si(e):[]},zn.uniqBy=function(e,t){return e&&e.length?si(e,aa(t,2)):[]},zn.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?si(e,i,t):[]},zn.unset=function(e,t){return null==e||ui(e,t)},zn.unzip=no,zn.unzipWith=ro,zn.update=function(e,t,n){return null==e?e:ci(e,t,mi(n))},zn.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:ci(e,t,mi(n),r)},zn.values=Bs,zn.valuesIn=function(e){return null==e?[]:Ht(e,Zs(e))},zn.without=io,zn.words=Hs,zn.wrap=function(e,t){return Mo(mi(t),e)},zn.xor=ao,zn.xorBy=oo,zn.xorWith=so,zn.zip=uo,zn.zipObject=function(e,t){return pi(e||[],t||[],Qn)},zn.zipObjectDeep=function(e,t){return pi(e||[],t||[],Hr)},zn.zipWith=co,zn.entries=$s,zn.entriesIn=zs,zn.extend=ys,zn.extendWith=bs,ou(zn,zn),zn.add=gu,zn.attempt=Js,zn.camelCase=Ls,zn.capitalize=Ws,zn.ceil=_u,zn.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=ms(n))==n?n:0),t!==i&&(t=(t=ms(t))==t?t:0),ar(ms(e),t,n)},zn.clone=function(e){return or(e,4)},zn.cloneDeep=function(e){return or(e,5)},zn.cloneDeepWith=function(e,t){return or(e,5,t="function"==typeof t?t:i)},zn.cloneWith=function(e,t){return or(e,4,t="function"==typeof t?t:i)},zn.conformsTo=function(e,t){return null==t||sr(e,t,As(t))},zn.deburr=Ds,zn.defaultTo=function(e,t){return null==e||e!=e?t:e},zn.divide=yu,zn.endsWith=function(e,t,n){e=gs(e),t=oi(t);var r=e.length,a=n=n===i?r:ar(ps(n),0,r);return(n-=t.length)>=0&&e.slice(n,a)==t},zn.eq=Bo,zn.escape=function(e){return(e=gs(e))&&G.test(e)?e.replace(K,tn):e},zn.escapeRegExp=function(e){return(e=gs(e))&&ne.test(e)?e.replace(te,"\\$&"):e},zn.every=function(e,t,n){var r=Fo(e)?Et:dr;return n&&va(e,t,n)&&(t=i),r(e,aa(t,3))},zn.find=mo,zn.findIndex=Wa,zn.findKey=function(e,t){return $t(e,aa(t,3),_r)},zn.findLast=vo,zn.findLastIndex=Da,zn.findLastKey=function(e,t){return $t(e,aa(t,3),yr)},zn.floor=bu,zn.forEach=go,zn.forEachRight=_o,zn.forIn=function(e,t){return null==e?e:vr(e,aa(t,3),Zs)},zn.forInRight=function(e,t){return null==e?e:gr(e,aa(t,3),Zs)},zn.forOwn=function(e,t){return e&&_r(e,aa(t,3))},zn.forOwnRight=function(e,t){return e&&yr(e,aa(t,3))},zn.get=Os,zn.gt=Lo,zn.gte=Wo,zn.has=function(e,t){return null!=e&&da(e,t,Or)},zn.hasIn=Ts,zn.head=Ua,zn.identity=nu,zn.includes=function(e,t,n,r){e=Vo(e)?e:Bs(e),n=n&&!r?ps(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),os(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&Bt(e,t,n)>-1},zn.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:ps(n);return i<0&&(i=vn(r+i,0)),Bt(e,t,i)},zn.inRange=function(e,t,n){return t=ds(t),n===i?(n=t,t=0):n=ds(n),function(e,t,n){return e>=gn(t,n)&&e=-9007199254740991&&e<=f},zn.isSet=as,zn.isString=os,zn.isSymbol=ss,zn.isTypedArray=us,zn.isUndefined=function(e){return e===i},zn.isWeakMap=function(e){return es(e)&&fa(e)==A},zn.isWeakSet=function(e){return es(e)&&"[object WeakSet]"==kr(e)},zn.join=function(e,t){return null==e?"":Ut.call(e,t)},zn.kebabCase=Fs,zn.last=Ga,zn.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var a=r;return n!==i&&(a=(a=ps(n))<0?vn(r+a,0):gn(a,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,a):zt(e,Wt,a,!0)},zn.lowerCase=Us,zn.lowerFirst=Vs,zn.lt=cs,zn.lte=ls,zn.max=function(e){return e&&e.length?pr(e,nu,Sr):i},zn.maxBy=function(e,t){return e&&e.length?pr(e,aa(t,2),Sr):i},zn.mean=function(e){return Dt(e,nu)},zn.meanBy=function(e,t){return Dt(e,aa(t,2))},zn.min=function(e){return e&&e.length?pr(e,nu,Pr):i},zn.minBy=function(e,t){return e&&e.length?pr(e,aa(t,2),Pr):i},zn.stubArray=hu,zn.stubFalse=mu,zn.stubObject=function(){return{}},zn.stubString=function(){return""},zn.stubTrue=function(){return!0},zn.multiply=xu,zn.nth=function(e,t){return e&&e.length?Lr(e,ps(t)):i},zn.noConflict=function(){return ft._===this&&(ft._=ze),this},zn.noop=su,zn.now=Oo,zn.pad=function(e,t,n){e=gs(e);var r=(t=ps(t))?ln(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Wi(pt(i),n)+e+Wi(dt(i),n)},zn.padEnd=function(e,t,n){e=gs(e);var r=(t=ps(t))?ln(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var a=bn();return gn(e+a*(t-e+st("1e-"+((a+"").length-1))),t)}return Vr(e,t)},zn.reduce=function(e,t,n){var r=Fo(e)?Rt:Vt,i=arguments.length<3;return r(e,aa(t,4),n,i,lr)},zn.reduceRight=function(e,t,n){var r=Fo(e)?Nt:Vt,i=arguments.length<3;return r(e,aa(t,4),n,i,fr)},zn.repeat=function(e,t,n){return t=(n?va(e,t,n):t===i)?1:ps(t),Kr(gs(e),t)},zn.replace=function(){var e=arguments,t=gs(e[0]);return e.length<3?t:t.replace(e[1],e[2])},zn.result=function(e,t,n){var r=-1,a=(t=vi(t,e)).length;for(a||(a=1,e=i);++rf)return[];var n=p,r=gn(e,p);t=aa(t),e-=p;for(var i=qt(r,t);++n=o)return e;var u=n-ln(r);if(u<1)return r;var c=s?_i(s,0,u).join(""):e.slice(0,u);if(a===i)return c+r;if(s&&(u+=c.length-u),is(a)){if(e.slice(u).search(a)){var l,f=c;for(a.global||(a=Oe(a.source,gs(de.exec(a))+"g")),a.lastIndex=0;l=a.exec(f);)var d=l.index;c=c.slice(0,d===i?u:d)}}else if(e.indexOf(oi(a),u)!=u){var p=c.lastIndexOf(a);p>-1&&(c=c.slice(0,p))}return c+r},zn.unescape=function(e){return(e=gs(e))&&q.test(e)?e.replace(V,pn):e},zn.uniqueId=function(e){var t=++Ne;return gs(e)+t},zn.upperCase=Gs,zn.upperFirst=Xs,zn.each=go,zn.eachRight=_o,zn.first=Ua,ou(zn,(vu={},_r(zn,(function(e,t){Re.call(zn.prototype,t)||(vu[t]=e)})),vu),{chain:!1}),zn.VERSION="4.17.21",Ot(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){zn[e].placeholder=zn})),Ot(["drop","take"],(function(e,t){Dn.prototype[e]=function(n){n=n===i?1:vn(ps(n),0);var r=this.__filtered__&&!t?new Dn(this):this.clone();return r.__filtered__?r.__takeCount__=gn(n,r.__takeCount__):r.__views__.push({size:gn(n,p),type:e+(r.__dir__<0?"Right":"")}),r},Dn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),Ot(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Dn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:aa(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),Ot(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Dn.prototype[e]=function(){return this[n](1).value()[0]}})),Ot(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Dn.prototype[e]=function(){return this.__filtered__?new Dn(this):this[n](1)}})),Dn.prototype.compact=function(){return this.filter(nu)},Dn.prototype.find=function(e){return this.filter(e).head()},Dn.prototype.findLast=function(e){return this.reverse().find(e)},Dn.prototype.invokeMap=qr((function(e,t){return"function"==typeof e?new Dn(this):this.map((function(n){return jr(n,e,t)}))})),Dn.prototype.reject=function(e){return this.filter(No(aa(e)))},Dn.prototype.slice=function(e,t){e=ps(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Dn(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=ps(t))<0?n.dropRight(-t):n.take(t-e)),n)},Dn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Dn.prototype.toArray=function(){return this.take(p)},_r(Dn.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),a=zn[r?"take"+("last"==t?"Right":""):t],o=r||/^find/.test(t);a&&(zn.prototype[t]=function(){var t=this.__wrapped__,s=r?[1]:arguments,u=t instanceof Dn,c=s[0],l=u||Fo(t),f=function(e){var t=a.apply(zn,It([e],s));return r&&d?t[0]:t};l&&n&&"function"==typeof c&&1!=c.length&&(u=l=!1);var d=this.__chain__,p=!!this.__actions__.length,h=o&&!d,m=u&&!p;if(!o&&l){t=m?t:new Dn(this);var v=e.apply(t,s);return v.__actions__.push({func:fo,args:[f],thisArg:i}),new Wn(v,d)}return h&&m?e.apply(this,s):(v=this.thru(f),h?r?v.value()[0]:v.value():v)})})),Ot(["pop","push","shift","sort","splice","unshift"],(function(e){var t=je[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);zn.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Fo(i)?i:[],e)}return this[n]((function(n){return t.apply(Fo(n)?n:[],e)}))}})),_r(Dn.prototype,(function(e,t){var n=zn[t];if(n){var r=n.name+"";Re.call(Cn,r)||(Cn[r]=[]),Cn[r].push({name:t,func:n})}})),Cn[$i(i,2).name]=[{name:"wrapper",func:i}],Dn.prototype.clone=function(){var e=new Dn(this.__wrapped__);return e.__actions__=Ti(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ti(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ti(this.__views__),e},Dn.prototype.reverse=function(){if(this.__filtered__){var e=new Dn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Dn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Fo(e),r=t<0,i=n?e.length:0,a=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},zn.prototype.plant=function(e){for(var t,n=this;n instanceof Ln;){var r=$a(n);r.__index__=0,r.__values__=i,t?a.__wrapped__=r:t=r;var a=r;n=n.__wrapped__}return a.__wrapped__=e,t},zn.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Dn){var t=e;return this.__actions__.length&&(t=new Dn(this)),(t=t.reverse()).__actions__.push({func:fo,args:[Ya],thisArg:i}),new Wn(t,this.__chain__)}return this.thru(Ya)},zn.prototype.toJSON=zn.prototype.valueOf=zn.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},zn.prototype.first=zn.prototype.head,Xe&&(zn.prototype[Xe]=function(){return this}),zn}();ft._=hn,(r=function(){return hn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},a=i[typeof window]&&window||this,o=i[typeof t]&&t,s=i.object&&e&&!e.nodeType&&e,u=o&&s&&"object"==typeof n.g&&n.g;!u||u.global!==u&&u.window!==u&&u.self!==u||(a=u);var c=Math.pow(2,53)-1,l=/\bOpera/,f=Object.prototype,d=f.hasOwnProperty,p=f.toString;function h(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function m(e){return e=b(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:h(e)}function v(e,t){for(var n in e)d.call(e,n)&&t(e[n],n,e)}function g(e){return null==e?h(e):p.call(e).slice(8,-1)}function _(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function y(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=c)for(;++n3?"WebKit":/\bOpera\b/.test(B)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(z)&&"WebKit"||!z&&/\bMSIE\b/i.test(t)&&("Mac OS"==D?"Tasman":"Trident")||"WebKit"==z&&/\bPlayStation\b(?! Vita\b)/i.test(B)&&"NetFront")&&(z=[s]),"IE"==B&&(s=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(B+=" Mobile",D="Windows Phone "+(/\+$/.test(s)?s:s+".x"),N.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(B="IE Mobile",D="Windows Phone 8.x",N.unshift("desktop mode"),$||($=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=B&&"Trident"==z&&(s=/\brv:([\d.]+)/.exec(t))&&(B&&N.push("identifying as "+B+($?" "+$:"")),B="IE",$=s[1]),M){if(f="global",d=null!=(c=n)?typeof c[f]:"number",/^(?:boolean|number|string|undefined)$/.test(d)||"object"==d&&!c[f])g(s=n.runtime)==w?(B="Adobe AIR",D=s.flash.system.Capabilities.os):g(s=n.phantom)==O?(B="PhantomJS",$=(s=s.version||null)&&s.major+"."+s.minor+"."+s.patch):"number"==typeof A.documentMode&&(s=/\bTrident\/(\d+)/i.exec(t))?($=[$,A.documentMode],(s=+s[1]+4)!=$[1]&&(N.push("IE "+$[1]+" mode"),z&&(z[1]=""),$[1]=s),$="IE"==B?String($[1].toFixed(1)):$[0]):"number"==typeof A.documentMode&&/^(?:Chrome|Firefox)\b/.test(B)&&(N.push("masking as "+B+" "+$),B="IE",$="11.0",z=["Trident"],D="Windows");else if(T&&(R=(s=T.lang.System).getProperty("os.arch"),D=D||s.getProperty("os.name")+" "+s.getProperty("os.version")),E){try{$=n.require("ringo/engine").version.join("."),B="RingoJS"}catch(e){(s=n.system)&&s.global.system==n.system&&(B="Narwhal",D||(D=s[0].os||null))}B||(B="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(s=n.process)&&("object"==typeof s.versions&&("string"==typeof s.versions.electron?(N.push("Node "+s.versions.node),B="Electron",$=s.versions.electron):"string"==typeof s.versions.nw&&(N.push("Chromium "+$,"Node "+s.versions.node),B="NW.js",$=s.versions.nw)),B||(B="Node.js",R=s.arch,D=s.platform,$=($=/[\d.]+/.exec(s.version))?$[0]:null));D=D&&m(D)}if($&&(s=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec($)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(M&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(P=/b/i.test(s)?"beta":"alpha",$=$.replace(RegExp(s+"\\+?$"),"")+("beta"==P?C:j)+(/\d+\+?/.exec(s)||"")),"Fennec"==B||"Firefox"==B&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(D))B="Firefox Mobile";else if("Maxthon"==B&&$)$=$.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(L))"Xbox 360"==L&&(D=null),"Xbox 360"==L&&/\bIEMobile\b/.test(t)&&N.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(B)&&(!B||L||/Browser|Mobi/.test(B))||"Windows CE"!=D&&!/Mobi/i.test(t))if("IE"==B&&M)try{null===n.external&&N.unshift("platform preview")}catch(e){N.unshift("embedded")}else(/\bBlackBerry\b/.test(L)||/\bBB10\b/.test(t))&&(s=(RegExp(L.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||$)?(D=((s=[s,/BB10/.test(t)])[1]?(L=null,W="BlackBerry"):"Device Software")+" "+s[0],$=null):this!=v&&"Wii"!=L&&(M&&Z||/Opera/.test(B)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==B&&/\bOS X (?:\d+\.){2,}/.test(D)||"IE"==B&&(D&&!/^Win/.test(D)&&$>5.5||/\bWindows XP\b/.test(D)&&$>8||8==$&&!/\bTrident\b/.test(t)))&&!l.test(s=e.call(v,t.replace(l,"")+";"))&&s.name&&(s="ing as "+s.name+((s=s.version)?" "+s:""),l.test(B)?(/\bIE\b/.test(s)&&"Mac OS"==D&&(D=null),s="identify"+s):(s="mask"+s,B=I?m(I.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(s)&&(D=null),M||($=null)),z=["Presto"],N.push(s));else B+=" Mobile";(s=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(s=[parseFloat(s.replace(/\.(\d)$/,".0$1")),s],"Safari"==B&&"+"==s[1].slice(-1)?(B="WebKit Nightly",P="alpha",$=s[1].slice(0,-1)):$!=s[1]&&$!=(s[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||($=null),s[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==s[0]&&537.36==s[2]&&parseFloat(s[1])>=28&&"WebKit"==z&&(z=["Blink"]),M&&(h||s[1])?(z&&(z[1]="like Chrome"),s=s[1]||((s=s[0])<530?1:s<532?2:s<532.05?3:s<533?4:s<534.03?5:s<534.07?6:s<534.1?7:s<534.13?8:s<534.16?9:s<534.24?10:s<534.3?11:s<535.01?12:s<535.02?"13+":s<535.07?15:s<535.11?16:s<535.19?17:s<536.05?18:s<536.1?19:s<537.01?20:s<537.11?"21+":s<537.13?23:s<537.18?24:s<537.24?25:s<537.36?26:"Blink"!=z?"27":"28")):(z&&(z[1]="like Safari"),s=(s=s[0])<400?1:s<500?2:s<526?3:s<533?4:s<534?"4+":s<535?5:s<537?6:s<538?7:s<601?8:s<602?9:s<604?10:s<606?11:s<608?12:"12"),z&&(z[1]+=" "+(s+="number"==typeof s?".x":/[.+]/.test(s)?"":"+")),"Safari"==B&&(!$||parseInt($)>45)?$=s:"Chrome"==B&&/\bHeadlessChrome/i.test(t)&&N.unshift("headless")),"Opera"==B&&(s=/\bzbov|zvav$/.exec(D))?(B+=" ",N.unshift("desktop mode"),"zvav"==s?(B+="Mini",$=null):B+="Mobile",D=D.replace(RegExp(" *"+s+"$"),"")):"Safari"==B&&/\bChrome\b/.exec(z&&z[1])?(N.unshift("desktop mode"),B="Chrome Mobile",$=null,/\bOS X\b/.test(D)?(W="Apple",D="iOS 4.3+"):D=null):/\bSRWare Iron\b/.test(B)&&!$&&($=U("Chrome")),$&&0==$.indexOf(s=/[\d.]+$/.exec(D))&&t.indexOf("/"+s+"-")>-1&&(D=b(D.replace(s,""))),D&&-1!=D.indexOf(B)&&!RegExp(B+" OS").test(D)&&(D=D.replace(RegExp(" *"+_(B)+" *"),"")),z&&!/\b(?:Avant|Nook)\b/.test(B)&&(/Browser|Lunascape|Maxthon/.test(B)||"Safari"!=B&&/^iOS/.test(D)&&/\bSafari\b/.test(z[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(B)&&z[1])&&(s=z[z.length-1])&&N.push(s),N.length&&(N=["("+N.join("; ")+")"]),W&&L&&L.indexOf(W)<0&&N.push("on "+W),L&&N.push((/^on /.test(N[N.length-1])?"":"on ")+L),D&&(s=/ ([\d.+]+)$/.exec(D),u=s&&"/"==D.charAt(D.length-s[0].length-1),D={architecture:32,family:s&&!u?D.replace(s[0],""):D,version:s?s[1]:null,toString:function(){var e=this.version;return this.family+(e&&!u?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(s=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(R))&&!/\bi686\b/i.test(R)?(D&&(D.architecture=64,D.family=D.family.replace(RegExp(" *"+s),"")),B&&(/\bWOW64\b/i.test(t)||M&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&N.unshift("32-bit")):D&&/^OS X/.test(D.family)&&"Chrome"==B&&parseFloat($)>=39&&(D.architecture=64),t||(t=null);var V={};return V.description=t,V.layout=z&&z[0],V.manufacturer=W,V.name=B,V.prerelease=P,V.product=L,V.ua=t,V.version=B&&$,V.os=D||{architecture:null,family:null,version:null,toString:function(){return"null"}},V.parse=e,V.toString=function(){return this.description||""},V.version&&N.unshift($),V.name&&N.unshift(B),D&&B&&(D!=String(D).split(" ")[0]||D!=B.split(" ")[0]&&!L)&&N.push(L?"("+D+")":"on "+D),N.length&&(V.description=N.join(" ")),V}();a.platform=x,void 0===(r=function(){return x}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var a=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.loaded=!0,a.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";var e,t;n.r(r),function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},e.getValidEnumValues=t=>{const n=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),r={};for(const e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(const n of e)if(t(n))return n},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(e||(e={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(t||(t={}));const i=e.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),a=e=>{switch(typeof e){case"undefined":return i.undefined;case"string":return i.string;case"number":return isNaN(e)?i.nan:i.number;case"boolean":return i.boolean;case"function":return i.function;case"bigint":return i.bigint;case"symbol":return i.symbol;case"object":return Array.isArray(e)?i.array:null===e?i.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?i.promise:"undefined"!=typeof Map&&e instanceof Map?i.map:"undefined"!=typeof Set&&e instanceof Set?i.set:"undefined"!=typeof Date&&e instanceof Date?i.date:i.object;default:return i.unknown}},o=e.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class s extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(r);else if("invalid_return_type"===i.code)r(i.returnTypeError);else if("invalid_arguments"===i.code)r(i.argumentsError);else if(0===i.path.length)n._errors.push(t(i));else{let e=n,r=0;for(;re.message)){const t={},n=[];for(const r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}s.create=e=>new s(e);const u=(t,n)=>{let r;switch(t.code){case o.invalid_type:r=t.received===i.undefined?"Required":`Expected ${t.expected}, received ${t.received}`;break;case o.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,e.jsonStringifyReplacer)}`;break;case o.unrecognized_keys:r=`Unrecognized key(s) in object: ${e.joinValues(t.keys,", ")}`;break;case o.invalid_union:r="Invalid input";break;case o.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${e.joinValues(t.options)}`;break;case o.invalid_enum_value:r=`Invalid enum value. Expected ${e.joinValues(t.options)}, received '${t.received}'`;break;case o.invalid_arguments:r="Invalid function arguments";break;case o.invalid_return_type:r="Invalid function return type";break;case o.invalid_date:r="Invalid date";break;case o.invalid_string:"object"==typeof t.validation?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,"number"==typeof t.validation.position&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:e.assertNever(t.validation):r="regex"!==t.validation?`Invalid ${t.validation}`:"Invalid";break;case o.too_small:r="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:"number"===t.type?`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:"date"===t.type?`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:"Invalid input";break;case o.too_big:r="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:"number"===t.type?`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"bigint"===t.type?`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"date"===t.type?`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:"Invalid input";break;case o.custom:r="Invalid input";break;case o.invalid_intersection_types:r="Intersection results could not be merged";break;case o.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case o.not_finite:r="Number must be finite";break;default:r=n.defaultError,e.assertNever(t)}return{message:r}};let c=u;function l(){return c}const f=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};let s="";const u=r.filter((e=>!!e)).slice().reverse();for(const e of u)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:i.message||s}};function d(e,t){const n=f({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,l(),u].filter((e=>!!e))});e.common.issues.push(n)}class p{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const r of t){if("aborted"===r.status)return h;"dirty"===r.status&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const e of t)n.push({key:await e.key,value:await e.value});return p.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const r of t){const{key:t,value:i}=r;if("aborted"===t.status)return h;if("aborted"===i.status)return h;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"===t.value||void 0===i.value&&!r.alwaysSet||(n[t.value]=i.value)}return{status:e.value,value:n}}}const h=Object.freeze({status:"aborted"}),m=e=>({status:"dirty",value:e}),v=e=>({status:"valid",value:e}),g=e=>"aborted"===e.status,_=e=>"dirty"===e.status,y=e=>"valid"===e.status,b=e=>"undefined"!=typeof Promise&&e instanceof Promise;var x;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(x||(x={}));class w{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const k=(e,t)=>{if(y(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new s(e.common.issues);return this._error=t,this._error}}};function S(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:i}:{errorMap:(e,t)=>"invalid_type"!==e.code?{message:t.defaultError}:void 0===t.data?{message:null!=r?r:t.defaultError}:{message:null!=n?n:t.defaultError},description:i}}class O{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return a(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:a(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new p,ctx:{common:e.parent.common,data:e.data,parsedType:a(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(b(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const r={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:a(e)},i=this._parseSync({data:e,path:r.path,parent:r});return k(r,i)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:a(e)},r=this._parse({data:e,path:n.path,parent:n}),i=await(b(r)?r:Promise.resolve(r));return k(n,i)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,r)=>{const i=e(t),a=()=>r.addIssue({code:o.custom,...n(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then((e=>!!e||(a(),!1))):!!i||(a(),!1)}))}refinement(e,t){return this._refinement(((n,r)=>!!e(n)||(r.addIssue("function"==typeof t?t(n,r):t),!1)))}_refinement(e){return new de({schema:this,typeName:Se.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return pe.create(this,this._def)}nullable(){return he.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return q.create(this,this._def)}promise(){return fe.create(this,this._def)}or(e){return H.create([this,e],this._def)}and(e){return ee.create(this,e,this._def)}transform(e){return new de({...S(this._def),schema:this,typeName:Se.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new me({...S(this._def),innerType:this,defaultValue:t,typeName:Se.ZodDefault})}brand(){return new ye({typeName:Se.ZodBranded,type:this,...S(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new ve({...S(this._def),innerType:this,catchValue:t,typeName:Se.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return be.create(this,e)}readonly(){return xe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const T=/^c[^\s-]{8,}$/i,E=/^[a-z][a-z0-9]*$/,j=/^[0-9A-HJKMNP-TV-Z]{26}$/,C=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,A=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let Z;const I=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,R=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;class N extends O{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==i.string){const e=this._getOrReturnCtx(t);return d(e,{code:o.invalid_type,expected:i.string,received:e.parsedType}),h}const n=new p;let r;for(const i of this._def.checks)if("min"===i.kind)t.data.lengthi.value&&(r=this._getOrReturnCtx(t,r),d(r,{code:o.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if("length"===i.kind){const e=t.data.length>i.value,a=t.data.lengthe.test(t)),{validation:t,code:o.invalid_string,...x.errToObj(n)})}_addCheck(e){return new N({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...x.errToObj(e)})}url(e){return this._addCheck({kind:"url",...x.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...x.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...x.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...x.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...x.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...x.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...x.errToObj(e)})}datetime(e){var t;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,...x.errToObj(null==e?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...x.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...x.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...x.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...x.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...x.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...x.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...x.errToObj(t)})}nonempty(e){return this.min(1,x.errToObj(e))}trim(){return new N({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new N({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new N({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuer?n:r;return parseInt(e.toFixed(i).replace(".",""))%parseInt(t.toFixed(i).replace(".",""))/Math.pow(10,i)}N.create=e=>{var t;return new N({checks:[],typeName:Se.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...S(e)})};class M extends O{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==i.number){const e=this._getOrReturnCtx(t);return d(e,{code:o.invalid_type,expected:i.number,received:e.parsedType}),h}let n;const r=new p;for(const i of this._def.checks)"int"===i.kind?e.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),d(n,{code:o.invalid_type,expected:"integer",received:"float",message:i.message}),r.dirty()):"min"===i.kind?(i.inclusive?t.datai.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),d(n,{code:o.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):"multipleOf"===i.kind?0!==P(t.data,i.value)&&(n=this._getOrReturnCtx(t,n),d(n,{code:o.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):"finite"===i.kind?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),d(n,{code:o.not_finite,message:i.message}),r.dirty()):e.assertNever(i);return{status:r.value,value:t.data}}gte(e,t){return this.setLimit("min",e,!0,x.toString(t))}gt(e,t){return this.setLimit("min",e,!1,x.toString(t))}lte(e,t){return this.setLimit("max",e,!0,x.toString(t))}lt(e,t){return this.setLimit("max",e,!1,x.toString(t))}setLimit(e,t,n,r){return new M({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:x.toString(r)}]})}_addCheck(e){return new M({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:x.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:x.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:x.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:x.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:x.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:x.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:x.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:x.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:x.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value"int"===t.kind||"multipleOf"===t.kind&&e.isInteger(t.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.valuenew M({checks:[],typeName:Se.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...S(e)});class $ extends O{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==i.bigint){const e=this._getOrReturnCtx(t);return d(e,{code:o.invalid_type,expected:i.bigint,received:e.parsedType}),h}let n;const r=new p;for(const i of this._def.checks)"min"===i.kind?(i.inclusive?t.datai.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),d(n,{code:o.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):"multipleOf"===i.kind?t.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),d(n,{code:o.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):e.assertNever(i);return{status:r.value,value:t.data}}gte(e,t){return this.setLimit("min",e,!0,x.toString(t))}gt(e,t){return this.setLimit("min",e,!1,x.toString(t))}lte(e,t){return this.setLimit("max",e,!0,x.toString(t))}lt(e,t){return this.setLimit("max",e,!1,x.toString(t))}setLimit(e,t,n,r){return new $({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:x.toString(r)}]})}_addCheck(e){return new $({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:x.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:x.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:x.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:x.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:x.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value{var t;return new $({checks:[],typeName:Se.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...S(e)})};class z extends O{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==i.boolean){const t=this._getOrReturnCtx(e);return d(t,{code:o.invalid_type,expected:i.boolean,received:t.parsedType}),h}return v(e.data)}}z.create=e=>new z({typeName:Se.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...S(e)});class B extends O{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==i.date){const e=this._getOrReturnCtx(t);return d(e,{code:o.invalid_type,expected:i.date,received:e.parsedType}),h}if(isNaN(t.data.getTime()))return d(this._getOrReturnCtx(t),{code:o.invalid_date}),h;const n=new p;let r;for(const i of this._def.checks)"min"===i.kind?t.data.getTime()i.value&&(r=this._getOrReturnCtx(t,r),d(r,{code:o.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):e.assertNever(i);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(e){return new B({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:x.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:x.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuenew B({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Se.ZodDate,...S(e)});class L extends O{_parse(e){if(this._getType(e)!==i.symbol){const t=this._getOrReturnCtx(e);return d(t,{code:o.invalid_type,expected:i.symbol,received:t.parsedType}),h}return v(e.data)}}L.create=e=>new L({typeName:Se.ZodSymbol,...S(e)});class W extends O{_parse(e){if(this._getType(e)!==i.undefined){const t=this._getOrReturnCtx(e);return d(t,{code:o.invalid_type,expected:i.undefined,received:t.parsedType}),h}return v(e.data)}}W.create=e=>new W({typeName:Se.ZodUndefined,...S(e)});class D extends O{_parse(e){if(this._getType(e)!==i.null){const t=this._getOrReturnCtx(e);return d(t,{code:o.invalid_type,expected:i.null,received:t.parsedType}),h}return v(e.data)}}D.create=e=>new D({typeName:Se.ZodNull,...S(e)});class F extends O{constructor(){super(...arguments),this._any=!0}_parse(e){return v(e.data)}}F.create=e=>new F({typeName:Se.ZodAny,...S(e)});class U extends O{constructor(){super(...arguments),this._unknown=!0}_parse(e){return v(e.data)}}U.create=e=>new U({typeName:Se.ZodUnknown,...S(e)});class V extends O{_parse(e){const t=this._getOrReturnCtx(e);return d(t,{code:o.invalid_type,expected:i.never,received:t.parsedType}),h}}V.create=e=>new V({typeName:Se.ZodNever,...S(e)});class K extends O{_parse(e){if(this._getType(e)!==i.undefined){const t=this._getOrReturnCtx(e);return d(t,{code:o.invalid_type,expected:i.void,received:t.parsedType}),h}return v(e.data)}}K.create=e=>new K({typeName:Se.ZodVoid,...S(e)});class q extends O{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==i.array)return d(t,{code:o.invalid_type,expected:i.array,received:t.parsedType}),h;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,i=t.data.lengthr.maxLength.value&&(d(t,{code:o.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>r.type._parseAsync(new w(t,e,t.path,n))))).then((e=>p.mergeArray(n,e)));const a=[...t.data].map(((e,n)=>r.type._parseSync(new w(t,e,t.path,n))));return p.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new q({...this._def,minLength:{value:e,message:x.toString(t)}})}max(e,t){return new q({...this._def,maxLength:{value:e,message:x.toString(t)}})}length(e,t){return new q({...this._def,exactLength:{value:e,message:x.toString(t)}})}nonempty(e){return this.min(1,e)}}function G(e){if(e instanceof X){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=pe.create(G(r))}return new X({...e._def,shape:()=>t})}return e instanceof q?new q({...e._def,type:G(e.element)}):e instanceof pe?pe.create(G(e.unwrap())):e instanceof he?he.create(G(e.unwrap())):e instanceof te?te.create(e.items.map((e=>G(e)))):e}q.create=(e,t)=>new q({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Se.ZodArray,...S(t)});class X extends O{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const t=this._def.shape(),n=e.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(e){if(this._getType(e)!==i.object){const t=this._getOrReturnCtx(e);return d(t,{code:o.invalid_type,expected:i.object,received:t.parsedType}),h}const{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof V&&"strip"===this._def.unknownKeys))for(const e in n.data)a.includes(e)||s.push(e);const u=[];for(const e of a){const t=r[e],i=n.data[e];u.push({key:{status:"valid",value:e},value:t._parse(new w(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof V){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of s)u.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)s.length>0&&(d(n,{code:o.unrecognized_keys,keys:s}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of s){const r=n.data[t];u.push({key:{status:"valid",value:t},value:e._parse(new w(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of u){const n=await t.key;e.push({key:n,value:await t.value,alwaysSet:t.alwaysSet})}return e})).then((e=>p.mergeObjectSync(t,e))):p.mergeObjectSync(t,u)}get shape(){return this._def.shape()}strict(e){return x.errToObj,new X({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var r,i,a,o;const s=null!==(a=null===(i=(r=this._def).errorMap)||void 0===i?void 0:i.call(r,t,n).message)&&void 0!==a?a:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(o=x.errToObj(e).message)&&void 0!==o?o:s}:{message:s}}}:{}})}strip(){return new X({...this._def,unknownKeys:"strip"})}passthrough(){return new X({...this._def,unknownKeys:"passthrough"})}extend(e){return new X({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new X({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Se.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new X({...this._def,catchall:e})}pick(t){const n={};return e.objectKeys(t).forEach((e=>{t[e]&&this.shape[e]&&(n[e]=this.shape[e])})),new X({...this._def,shape:()=>n})}omit(t){const n={};return e.objectKeys(this.shape).forEach((e=>{t[e]||(n[e]=this.shape[e])})),new X({...this._def,shape:()=>n})}deepPartial(){return G(this)}partial(t){const n={};return e.objectKeys(this.shape).forEach((e=>{const r=this.shape[e];t&&!t[e]?n[e]=r:n[e]=r.optional()})),new X({...this._def,shape:()=>n})}required(t){const n={};return e.objectKeys(this.shape).forEach((e=>{if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof pe;)t=t._def.innerType;n[e]=t}})),new X({...this._def,shape:()=>n})}keyof(){return ue(e.objectKeys(this.shape))}}X.create=(e,t)=>new X({shape:()=>e,unknownKeys:"strip",catchall:V.create(),typeName:Se.ZodObject,...S(t)}),X.strictCreate=(e,t)=>new X({shape:()=>e,unknownKeys:"strict",catchall:V.create(),typeName:Se.ZodObject,...S(t)}),X.lazycreate=(e,t)=>new X({shape:e,unknownKeys:"strip",catchall:V.create(),typeName:Se.ZodObject,...S(t)});class H extends O{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const n=e.map((e=>new s(e.ctx.common.issues)));return d(t,{code:o.invalid_union,unionErrors:n}),h}));{let e;const r=[];for(const i of n){const n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if("valid"===a.status)return a;"dirty"!==a.status||e||(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const i=r.map((e=>new s(e)));return d(t,{code:o.invalid_union,unionErrors:i}),h}}get options(){return this._def.options}}H.create=(e,t)=>new H({options:e,typeName:Se.ZodUnion,...S(t)});const J=e=>e instanceof oe?J(e.schema):e instanceof de?J(e.innerType()):e instanceof se?[e.value]:e instanceof ce?e.options:e instanceof le?Object.keys(e.enum):e instanceof me?J(e._def.innerType):e instanceof W?[void 0]:e instanceof D?[null]:null;class Y extends O{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==i.object)return d(t,{code:o.invalid_type,expected:i.object,received:t.parsedType}),h;const n=this.discriminator,r=t.data[n],a=this.optionsMap.get(r);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(d(t,{code:o.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),h)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const r=new Map;for(const n of t){const t=J(n.shape[e]);if(!t)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const i of t){if(r.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);r.set(i,n)}}return new Y({typeName:Se.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...S(n)})}}function Q(t,n){const r=a(t),o=a(n);if(t===n)return{valid:!0,data:t};if(r===i.object&&o===i.object){const r=e.objectKeys(n),i=e.objectKeys(t).filter((e=>-1!==r.indexOf(e))),a={...t,...n};for(const e of i){const r=Q(t[e],n[e]);if(!r.valid)return{valid:!1};a[e]=r.data}return{valid:!0,data:a}}if(r===i.array&&o===i.array){if(t.length!==n.length)return{valid:!1};const e=[];for(let r=0;r{if(g(e)||g(r))return h;const i=Q(e.value,r.value);return i.valid?((_(e)||_(r))&&t.dirty(),{status:t.value,value:i.data}):(d(n,{code:o.invalid_intersection_types}),h)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then((([e,t])=>r(e,t))):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}ee.create=(e,t,n)=>new ee({left:e,right:t,typeName:Se.ZodIntersection,...S(n)});class te extends O{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==i.array)return d(n,{code:o.invalid_type,expected:i.array,received:n.parsedType}),h;if(n.data.lengththis._def.items.length&&(d(n,{code:o.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...n.data].map(((e,t)=>{const r=this._def.items[t]||this._def.rest;return r?r._parse(new w(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(r).then((e=>p.mergeArray(t,e))):p.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new te({...this._def,rest:e})}}te.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new te({items:e,typeName:Se.ZodTuple,rest:null,...S(t)})};class ne extends O{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==i.object)return d(n,{code:o.invalid_type,expected:i.object,received:n.parsedType}),h;const r=[],a=this._def.keyType,s=this._def.valueType;for(const e in n.data)r.push({key:a._parse(new w(n,e,n.path,e)),value:s._parse(new w(n,n.data[e],n.path,e))});return n.common.async?p.mergeObjectAsync(t,r):p.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,n){return new ne(t instanceof O?{keyType:e,valueType:t,typeName:Se.ZodRecord,...S(n)}:{keyType:N.create(),valueType:e,typeName:Se.ZodRecord,...S(t)})}}class re extends O{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==i.map)return d(n,{code:o.invalid_type,expected:i.map,received:n.parsedType}),h;const r=this._def.keyType,a=this._def.valueType,s=[...n.data.entries()].map((([e,t],i)=>({key:r._parse(new w(n,e,n.path,[i,"key"])),value:a._parse(new w(n,t,n.path,[i,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of s){const r=await n.key,i=await n.value;if("aborted"===r.status||"aborted"===i.status)return h;"dirty"!==r.status&&"dirty"!==i.status||t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of s){const r=n.key,i=n.value;if("aborted"===r.status||"aborted"===i.status)return h;"dirty"!==r.status&&"dirty"!==i.status||t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}}re.create=(e,t,n)=>new re({valueType:t,keyType:e,typeName:Se.ZodMap,...S(n)});class ie extends O{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==i.set)return d(n,{code:o.invalid_type,expected:i.set,received:n.parsedType}),h;const r=this._def;null!==r.minSize&&n.data.sizer.maxSize.value&&(d(n,{code:o.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const a=this._def.valueType;function s(e){const n=new Set;for(const r of e){if("aborted"===r.status)return h;"dirty"===r.status&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}const u=[...n.data.values()].map(((e,t)=>a._parse(new w(n,e,n.path,t))));return n.common.async?Promise.all(u).then((e=>s(e))):s(u)}min(e,t){return new ie({...this._def,minSize:{value:e,message:x.toString(t)}})}max(e,t){return new ie({...this._def,maxSize:{value:e,message:x.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}ie.create=(e,t)=>new ie({valueType:e,minSize:null,maxSize:null,typeName:Se.ZodSet,...S(t)});class ae extends O{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==i.function)return d(t,{code:o.invalid_type,expected:i.function,received:t.parsedType}),h;function n(e,n){return f({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,l(),u].filter((e=>!!e)),issueData:{code:o.invalid_arguments,argumentsError:n}})}function r(e,n){return f({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,l(),u].filter((e=>!!e)),issueData:{code:o.invalid_return_type,returnTypeError:n}})}const a={errorMap:t.common.contextualErrorMap},c=t.data;if(this._def.returns instanceof fe){const e=this;return v((async function(...t){const i=new s([]),o=await e._def.args.parseAsync(t,a).catch((e=>{throw i.addIssue(n(t,e)),i})),u=await Reflect.apply(c,this,o);return await e._def.returns._def.type.parseAsync(u,a).catch((e=>{throw i.addIssue(r(u,e)),i}))}))}{const e=this;return v((function(...t){const i=e._def.args.safeParse(t,a);if(!i.success)throw new s([n(t,i.error)]);const o=Reflect.apply(c,this,i.data),u=e._def.returns.safeParse(o,a);if(!u.success)throw new s([r(o,u.error)]);return u.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ae({...this._def,args:te.create(e).rest(U.create())})}returns(e){return new ae({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new ae({args:e||te.create([]).rest(U.create()),returns:t||U.create(),typeName:Se.ZodFunction,...S(n)})}}class oe extends O{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}oe.create=(e,t)=>new oe({getter:e,typeName:Se.ZodLazy,...S(t)});class se extends O{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return d(t,{received:t.data,code:o.invalid_literal,expected:this._def.value}),h}return{status:"valid",value:e.data}}get value(){return this._def.value}}function ue(e,t){return new ce({values:e,typeName:Se.ZodEnum,...S(t)})}se.create=(e,t)=>new se({value:e,typeName:Se.ZodLiteral,...S(t)});class ce extends O{_parse(t){if("string"!=typeof t.data){const n=this._getOrReturnCtx(t),r=this._def.values;return d(n,{expected:e.joinValues(r),received:n.parsedType,code:o.invalid_type}),h}if(-1===this._def.values.indexOf(t.data)){const e=this._getOrReturnCtx(t),n=this._def.values;return d(e,{received:e.data,code:o.invalid_enum_value,options:n}),h}return v(t.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e){return ce.create(e)}exclude(e){return ce.create(this.options.filter((t=>!e.includes(t))))}}ce.create=ue;class le extends O{_parse(t){const n=e.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==i.string&&r.parsedType!==i.number){const t=e.objectValues(n);return d(r,{expected:e.joinValues(t),received:r.parsedType,code:o.invalid_type}),h}if(-1===n.indexOf(t.data)){const t=e.objectValues(n);return d(r,{received:r.data,code:o.invalid_enum_value,options:t}),h}return v(t.data)}get enum(){return this._def.values}}le.create=(e,t)=>new le({values:e,typeName:Se.ZodNativeEnum,...S(t)});class fe extends O{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==i.promise&&!1===t.common.async)return d(t,{code:o.invalid_type,expected:i.promise,received:t.parsedType}),h;const n=t.parsedType===i.promise?t.data:Promise.resolve(t.data);return v(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}fe.create=(e,t)=>new fe({type:e,typeName:Se.ZodPromise,...S(t)});class de extends O{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Se.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=this._def.effect||null,a={addIssue:e=>{d(r,e),e.fatal?n.abort():n.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),"preprocess"===i.type){const e=i.transform(r.data,a);return r.common.issues.length?{status:"dirty",value:r.data}:r.common.async?Promise.resolve(e).then((e=>this._def.schema._parseAsync({data:e,path:r.path,parent:r}))):this._def.schema._parseSync({data:e,path:r.path,parent:r})}if("refinement"===i.type){const e=e=>{const t=i.refinement(e,a);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===r.common.async){const t=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===t.status?h:("dirty"===t.status&&n.dirty(),e(t.value),{status:n.value,value:t.value})}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((t=>"aborted"===t.status?h:("dirty"===t.status&&n.dirty(),e(t.value).then((()=>({status:n.value,value:t.value}))))))}if("transform"===i.type){if(!1===r.common.async){const e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!y(e))return e;const t=i.transform(e.value,a);if(t instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:t}}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((e=>y(e)?Promise.resolve(i.transform(e.value,a)).then((e=>({status:n.value,value:e}))):e))}e.assertNever(i)}}de.create=(e,t,n)=>new de({schema:e,typeName:Se.ZodEffects,effect:t,...S(n)}),de.createWithPreprocess=(e,t,n)=>new de({schema:t,effect:{type:"preprocess",transform:e},typeName:Se.ZodEffects,...S(n)});class pe extends O{_parse(e){return this._getType(e)===i.undefined?v(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}pe.create=(e,t)=>new pe({innerType:e,typeName:Se.ZodOptional,...S(t)});class he extends O{_parse(e){return this._getType(e)===i.null?v(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}he.create=(e,t)=>new he({innerType:e,typeName:Se.ZodNullable,...S(t)});class me extends O{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===i.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}me.create=(e,t)=>new me({innerType:e,typeName:Se.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...S(t)});class ve extends O{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return b(r)?r.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new s(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new s(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}ve.create=(e,t)=>new ve({innerType:e,typeName:Se.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...S(t)});class ge extends O{_parse(e){if(this._getType(e)!==i.nan){const t=this._getOrReturnCtx(e);return d(t,{code:o.invalid_type,expected:i.nan,received:t.parsedType}),h}return{status:"valid",value:e.data}}}ge.create=e=>new ge({typeName:Se.ZodNaN,...S(e)});const _e=Symbol("zod_brand");class ye extends O{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class be extends O{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?h:"dirty"===e.status?(t.dirty(),m(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?h:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new be({in:e,out:t,typeName:Se.ZodPipeline})}}class xe extends O{_parse(e){const t=this._def.innerType._parse(e);return y(t)&&(t.value=Object.freeze(t.value)),t}}xe.create=(e,t)=>new xe({innerType:e,typeName:Se.ZodReadonly,...S(t)});const we=(e,t={},n)=>e?F.create().superRefine(((r,i)=>{var a,o;if(!e(r)){const e="function"==typeof t?t(r):"string"==typeof t?{message:t}:t,s=null===(o=null!==(a=e.fatal)&&void 0!==a?a:n)||void 0===o||o,u="string"==typeof e?{message:e}:e;i.addIssue({code:"custom",...u,fatal:s})}})):F.create(),ke={object:X.lazycreate};var Se;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Se||(Se={}));const Oe=N.create,Te=M.create,Ee=ge.create,je=$.create,Ce=z.create,Ae=B.create,Ze=L.create,Ie=W.create,Re=D.create,Ne=F.create,Pe=U.create,Me=V.create,$e=K.create,ze=q.create,Be=X.create,Le=X.strictCreate,We=H.create,De=Y.create,Fe=ee.create,Ue=te.create,Ve=ne.create,Ke=re.create,qe=ie.create,Ge=ae.create,Xe=oe.create,He=se.create,Je=ce.create,Ye=le.create,Qe=fe.create,et=de.create,tt=pe.create,nt=he.create,rt=de.createWithPreprocess,it=be.create,at={string:e=>N.create({...e,coerce:!0}),number:e=>M.create({...e,coerce:!0}),boolean:e=>z.create({...e,coerce:!0}),bigint:e=>$.create({...e,coerce:!0}),date:e=>B.create({...e,coerce:!0})},ot=h;var st=Object.freeze({__proto__:null,defaultErrorMap:u,setErrorMap:function(e){c=e},getErrorMap:l,makeIssue:f,EMPTY_PATH:[],addIssueToContext:d,ParseStatus:p,INVALID:h,DIRTY:m,OK:v,isAborted:g,isDirty:_,isValid:y,isAsync:b,get util(){return e},get objectUtil(){return t},ZodParsedType:i,getParsedType:a,ZodType:O,ZodString:N,ZodNumber:M,ZodBigInt:$,ZodBoolean:z,ZodDate:B,ZodSymbol:L,ZodUndefined:W,ZodNull:D,ZodAny:F,ZodUnknown:U,ZodNever:V,ZodVoid:K,ZodArray:q,ZodObject:X,ZodUnion:H,ZodDiscriminatedUnion:Y,ZodIntersection:ee,ZodTuple:te,ZodRecord:ne,ZodMap:re,ZodSet:ie,ZodFunction:ae,ZodLazy:oe,ZodLiteral:se,ZodEnum:ce,ZodNativeEnum:le,ZodPromise:fe,ZodEffects:de,ZodTransformer:de,ZodOptional:pe,ZodNullable:he,ZodDefault:me,ZodCatch:ve,ZodNaN:ge,BRAND:_e,ZodBranded:ye,ZodPipeline:be,ZodReadonly:xe,custom:we,Schema:O,ZodSchema:O,late:ke,get ZodFirstPartyTypeKind(){return Se},coerce:at,any:Ne,array:ze,bigint:je,boolean:Ce,date:Ae,discriminatedUnion:De,effect:et,enum:Je,function:Ge,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>we((t=>t instanceof e),t),intersection:Fe,lazy:Xe,literal:He,map:Ke,nan:Ee,nativeEnum:Ye,never:Me,null:Re,nullable:nt,number:Te,object:Be,oboolean:()=>Ce().optional(),onumber:()=>Te().optional(),optional:tt,ostring:()=>Oe().optional(),pipeline:it,preprocess:rt,promise:Qe,record:Ve,set:qe,strictObject:Le,string:Oe,symbol:Ze,transformer:et,tuple:Ue,undefined:Ie,union:We,unknown:Pe,void:$e,NEVER:ot,ZodIssueCode:o,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:s}),ut=n(215),ct=new(n.n(ut)().Suite);const lt={};ct.on("complete",(function(){const e=ct.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:lt[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),ct.add("Check an invalid model with Zod typecheck",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=st.object({id:st.number(),name:st.string(),age:st.number(),isHappy:st.boolean(),createdAt:st.date(),updatedAt:st.date().nullable(),favoriteColors:st.array(st.string()),favoriteNumbers:st.array(st.number()),favoriteFoods:st.array(st.object({name:st.string(),calories:st.number()}))}),n={id:1,name:"John"};try{t.parse(n)}catch(e){return}var r,i;r="Check an invalid model with Zod typecheck",i=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,lt[r]?lt[r]=Math.max(lt[r],i):lt[r]=i})),ct.on("cycle",(function(e){console.log(String(e.target))})),ct.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/check-an-invalid-model-with-zod-typecheck-web-bundle.js.LICENSE.txt b/build/check-an-invalid-model-with-zod-typecheck-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..5168058 --- /dev/null +++ b/build/check-an-invalid-model-with-zod-typecheck-web-bundle.js.LICENSE.txt @@ -0,0 +1,23 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/check-an-invalid-snapshot-with-mst-typecheck-bundle-source.js b/build/check-an-invalid-snapshot-with-mst-typecheck-bundle-source.js new file mode 100644 index 0000000..85b3fa4 --- /dev/null +++ b/build/check-an-invalid-snapshot-with-mst-typecheck-bundle-source.js @@ -0,0 +1,126 @@ + +import { types, typecheck } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Check an invalid snapshot with MST typecheck", () => { + const startMemory = getStartMemory(); + const ExampleModelMST = types.model({ + id: types.identifier, + name: types.string, + age: types.number, + isHappy: types.boolean, + createdAt: types.Date, + updatedAt: types.maybeNull(types.Date), + favoriteColors: types.array(types.string), + favoriteNumbers: types.array(types.number), + favoriteFoods: types.array( + types.model({ + name: types.string, + calories: types.number, + }) + ), +}); + +const FalseExampleModelMST = types.model({ + id: types.identifier, + shouldMatch: false, +}); + +try { + typecheck(FalseExampleModelMST, { + id: "1", + name: "John", + age: 42, + isHappy: true, + createdAt: new Date(), + updatedAt: null, + favoriteColors: ["blue", "green"], + favoriteNumbers: [1, 2, 3], + favoriteFoods: [ + { + name: "Pizza", + calories: 1000, + }, + ], + }); +} catch (e) { + return; +} + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Check an invalid snapshot with MST typecheck", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/check-an-invalid-snapshot-with-mst-typecheck-node-bundle.js b/build/check-an-invalid-snapshot-with-mst-typecheck-node-bundle.js new file mode 100644 index 0000000..b994252 --- /dev/null +++ b/build/check-an-invalid-snapshot-with-mst-typecheck-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see check-an-invalid-snapshot-with-mst-typecheck-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===J}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,$e(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),Je(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U($(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=kt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function kt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var Dt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function Jt(e){return Br(e)?e[F].keys_():Cr(e)||kr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function $t(e){return Br(e)?Jt(e).map((function(t){return e[t]})):Cr(e)?Jt(e).map((function(t){return e.get(t)})):kr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||kr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):kr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||kr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Yn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw ci("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Na(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Yn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=si,this.state=Yn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=Yn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw ci(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ti(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(ei(i=n.context,1),ti(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(si),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ai(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw ci("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw ci("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ii);if(!(""===e||"."===e||".."===e||Pi(e,"/")||Pi(e,"./")||Pi(e,"../")))throw ci("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ii(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),mi(this.storedValue,"$treenode",this),mi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Yn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=kt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new wi),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ti(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:Oi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Qn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Qn(t)?"value of type "+ti(t).type.name+":":yi(t)?"value":"snapshot",o=r&&Qn(t)&&r.is(ti(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return kn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||yi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return ui}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&qn(e,t)}function qn(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw ci(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}var Yn,Jn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Jn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],li));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw ci("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;$t(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?Jt(n).map((function(e){return[e,n[e]]})):Cr(n)?Jt(n).map((function(e){return[e,n.get(e)]})):kr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw ci("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Xn(e,t,r,n,i){var a=ri(i);if(a){if(a.parent)throw ci("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Zn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Qn(e){return!(!e||!e.$treenode)}function ei(e,t){ji()}function ti(e){if(!Qn(e))throw ci("Value "+e+" is no MST Node");return e.$treenode}function ri(e){return e&&e.$treenode||null}function ni(){return ti(this).snapshot}function ii(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Qn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Qn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Vi?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=kn(e)?this._subtype:Qn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Vi&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),ki="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=hi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Wi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Ri=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw ci("Map.put cannot be used to set empty values");if(Qn(e)){var t=ti(e);if(null===t.identifier)throw ci(ki);return this.set(t.identifier,e),e}if(vi(e)){var r=ti(this),n=r.type;if(n.identifierMode!==Ci.YES)throw ci(ki);var i=e[n.mapIdentifierAttribute];if(!Ca(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Na(i);return this.set(o,e),this.get(o)}throw ci("Map.put can only be used to store complex values")}}),t}(Nr),Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw ci("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Ri(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);mi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return $t(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw ci("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ti(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw ci("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ti(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ti(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ti(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ti(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return di(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return si}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Li.prototype.applySnapshot=Tt(Li.prototype.applySnapshot);var Mi=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},li),{name:this.name});return Ae.array(ai(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);mi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Qn(e)?ti(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),ua=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw ci("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw ci("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function ca(e,t,r){return function(e,t){if("function"!=typeof t&&Qn(t))throw ci("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dn()}(0,t),new la(e,t,r||fa)}var fa=[void 0],pa=ca(ta,void 0),ba=ca(ea,null);function ha(e){return Dn(),sa(e,pa)}var da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw ci("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),va=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Zn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):gi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),ya=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Zn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return gi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ga=new ya,ma=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Ca(e))this.identifier=e;else{if(!Qn(e))throw ci("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ti(e);if(!r.identifierAttribute)throw ci("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw ci("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Na(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new _a("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),_a=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),wa=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Ca(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;kn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ti(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Na(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Yn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),Oa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Qn(n)?(ei(i=n),ti(i).identifier):n,o=new ma(n,this.targetType),u=Zn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Qn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(wa),Pa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Qn(n)?this.options.set(n,e?e.storedValue:null):n,a=Zn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Qn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(wa);function ja(e,t){Dn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Pa(e,{get:r.get,set:r.set},n):new Oa(e,n)}var Sa=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Wi))throw ci("Identifier types can only be instantiated as direct child of a model type");return Zn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw ci("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Aa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(Sa),Ea=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(Sa),Ta=new Aa,Ia=new Ea;function Na(e){return""+e}function Ca(e){return"string"==typeof e||"number"==typeof e}var Va=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Zn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),xa={enumeration:function(e,t){var r="string"==typeof e?t:e,n=sa.apply(void 0,yn(r.map((function(e){return aa(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dn(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ga:kn(e)?new ya(e):ca(ga,e)},identifier:Ta,identifierNumber:Ia,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new da(r,"string"==typeof e?t:e)},lazy:function(e,t){return new va(e,t)},undefined:ta,null:ea,snapshotProcessor:function(e,t,r){return Dn(),new xi(e,t,r)}};const ka=require("benchmark");var Da=new(e.n(ka)().Suite);const Ra={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ra[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Check an invalid snapshot with MST typecheck",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=(xa.model({id:xa.identifier,name:xa.string,age:xa.number,isHappy:xa.boolean,createdAt:xa.Date,updatedAt:xa.maybeNull(xa.Date),favoriteColors:xa.array(xa.string),favoriteNumbers:xa.array(xa.number),favoriteFoods:xa.array(xa.model({name:xa.string,calories:xa.number}))}),xa.model({id:xa.identifier,shouldMatch:!1}));try{qn(t,{id:"1",name:"John",age:42,isHappy:!0,createdAt:new Date,updatedAt:null,favoriteColors:["blue","green"],favoriteNumbers:[1,2,3],favoriteFoods:[{name:"Pizza",calories:1e3}]})}catch(e){return}var r,n;r="Check an invalid snapshot with MST typecheck",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ra[r]?Ra[r]=Math.max(Ra[r],n):Ra[r]=n})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/check-an-invalid-snapshot-with-mst-typecheck-node-bundle.js.LICENSE.txt b/build/check-an-invalid-snapshot-with-mst-typecheck-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/check-an-invalid-snapshot-with-mst-typecheck-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/check-an-invalid-snapshot-with-mst-typecheck-web-bundle.js b/build/check-an-invalid-snapshot-with-mst-typecheck-web-bundle.js new file mode 100644 index 0000000..9adcfef --- /dev/null +++ b/build/check-an-invalid-snapshot-with-mst-typecheck-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see check-an-invalid-snapshot-with-mst-typecheck-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,s=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),l=a.object&&e&&!e.nodeType&&e,c=s&&l&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(l&&l.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,l=e.Object,c=(e.RegExp,e.String),_=[],m=l.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,le(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=s&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,s={currentTarget:e},l={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),s.type="cycle",s.target=r,n=W(s),l.onCycle.call(e,n),n.aborted||!1===b())s.type="complete",l.onComplete.call(e,W(s));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function se(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function le(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,s=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+s+")"),fnArg:s,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}le=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,s=Z(u.fn),l=u.count=i.count,f=s||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||s);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=l)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=l}if(!v&&!a&&!y){v=o(u,f,a,d=(s||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=l,delete i.error}catch(e){u.count=l,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),le.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,s,l,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:le(t),l=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((s=W("error")).message=t.error,t.emit(s),s.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==l?1:-1:0):f<=(u<5||s<3?0:y[u][s-3])?f==l?1:-1:0},emit:oe,listeners:ae,off:ue,on:se,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,s=u.destination,l=s[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(l)||(r=!0,l=[]),l.length!=e.length&&(r=!0,(l=l.slice(0,e.length)).length=e.length)):t.isObjectLike(l)||(r=!0,l={}),r&&i.push({destination:s,key:n,value:l}),a.push({destination:l,source:e})):t.eq(l,e)||e===o||i.push({destination:s,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,s=[],l=e.stats.sample;function c(){s.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(s,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=l.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=l.length=s.length=0)),_||(f=q(l),y=t.reduce(l,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),s.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",s=32,l=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",l],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",s],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,se=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,le=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,st=parseInt,lt="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=lt||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&<.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=so(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,lt=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=so(t,"DataView"),jn=so(t,"Map"),Pn=so(t,"Promise"),Sn=so(t,"Set"),An=so(t,"WeakMap"),xn=so(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,s=1&t,l=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!s)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,s);if(p==P||p==d||h&&!o){if(u=l||h?{}:ho(e),!s)return l?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,lo(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,s)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?l?to:eo:l?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function sr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function lr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,s=[],l=t.length;if(!u)return s;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,s=u,l=r(u),c=1/0,f=[];s--;){var p=e[s];s&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),l[s]=!n&&(t||a>=120&&p.length>=120)?new Gn(s&&p):i}p=e[0];var h=-1,b=l[0];e:for(;++h=u?s:s*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,s,1),Ke.call(e,s,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):si(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,ns),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,s=e;null!=s&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var l=t?null:Gi(e);if(l)return sn(l);a=!1,i=Zt,s=new Gn}else s=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,s=null===t,l=t==t,c=uu(t);if(!s&&!c&&!a&&e>t||a&&u&&l&&!s&&!c||r&&u&&l||!n&&l||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!s&&"wrapper"==ro(u))var s=new Fn([],!0)}for(r=s?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof l&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?ts))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=lt||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,l,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=s}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=s}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,s,l,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,s=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);l=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return l=i,b&&r?d(e):(r=a=i,s)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(l===i)return function(e){return f=e,l=Eo(y,t),p?d(e):s}(c);if(h)return _i(l),l=Eo(y,t),d(c)}return l===i&&(l=Eo(y,t)),s}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){l!==i&&_i(l),f=0,r=c=a=l=i},_.flush=function(){return l===i?s:g(Sa())},_}var Ia=Kr((function(e,t){return sr(e,1,t)})),ka=Kr((function(e,t,n){return sr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||ds,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var su=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},lu=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?sn:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?st(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)si(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(se)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var es=Ri(),ts=Ri(!0);function ns(e){return e}function rs(e){return Nr("function"==typeof e?e:ar(e,1))}var is=Kr((function(e,t){return function(n){return Er(n,e,t)}})),os=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function as(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function us(){}var ss=Bi(It),ls=Bi(xt),cs=Bi(Dt);function fs(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var ps=Ui(),hs=Ui(!0);function bs(){return[]}function ds(){return!1}var vs,ys=zi((function(e,t){return e+t}),0),gs=Hi("ceil"),_s=zi((function(e,t){return e/t}),1),ms=Hi("floor"),ws=zi((function(e,t){return e*t}),1),Os=Hi("round"),js=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,s=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||su(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||si(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:li(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:li(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=sa,Ln.zip=la,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,as(Ln,Ln),Ln.add=ys,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gs,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_s,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ms,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=ns,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=su,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=lu,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,ns,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,ns)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,ns,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bs,Ln.stubFalse=ds,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=ws,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=us,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var s=n-cn(r);if(s<1)return r;var l=u?gi(u,0,s).join(""):e.slice(0,s);if(o===i)return l+r;if(u&&(s+=l.length-s),iu(o)){if(e.slice(s).search(o)){var c,f=l;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;l=l.slice(0,p===i?s:p)}}else if(e.indexOf(ai(o),s)!=s){var h=l.lastIndexOf(o);h>-1&&(l=l.slice(0,h))}return l+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,as(Ln,(vs={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vs[t]=e)})),vs),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(ns)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,s=t instanceof Un,l=u[0],c=s||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof l&&1!=l.length&&(s=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=s&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,s=a&&u&&"object"==typeof n.g&&n.g;!s||s.global!==s&&s.window!==s&&s.self!==s||(o=s);var l=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=l)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(l=n)?typeof l[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!l[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),s=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!s?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!s?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var s=t[o];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=n[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)lt(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,s=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var l=Vt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(s,l);e.then(c,n)}e=n,s(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function sn(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=l),an(this)){var o=sn(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return l;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=sn(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!sn(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=ln(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=ln(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=ln(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return lr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return lr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var s=r.value;if(!i.has(s))if(n.delete(s))a=!0;else{var l=n.data_.get(s);o.set(s,l)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!sn(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=ln(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!sn(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=ln(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return lr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=sr(e),t=sr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function sr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function lr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Yr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var s=a._childNodes[a.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw ci("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Io(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=si,this.state=qr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=qr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw ci(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&Ei(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(ei(i=r.context,1),ti(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(si),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):oi(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw ci("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw ci("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||ji(e,"/")||ji(e,"./")||ji(e,"../")))throw ci("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ii(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),_i(this.storedValue,"$treenode",this),_i(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var s,l,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(s=r.onError,l=n,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new wi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ti(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:Oi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Qr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Qr(t)?"value of type "+ti(t).type.name+":":yi(t)?"value":"snapshot",a=n&&Qr(t)&&n.is(ti(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||yi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ui}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&Kr(e,t)}function Kr(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw ci(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}var qr,Xr=0,Yr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Xr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw ci("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(r),s=!0)}s&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw ci("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Zr(e,t,n,r,i){var o=ni(i);if(o){if(o.parent)throw ci("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Jr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Qr(e){return!(!e||!e.$treenode)}function ei(e,t){Pi()}function ti(e){if(!Qr(e))throw ci("Value "+e+" is no MST Node");return e.$treenode}function ni(e){return e&&e.$treenode||null}function ri(){return ti(this).snapshot}function ii(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Qr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Qr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===ki?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Qr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==ki&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Vi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=bi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Di(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Gi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ii||(Ii={}));var Ri=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw ci("Map.put cannot be used to set empty values");if(Qr(e)){var t=ti(e);if(null===t.identifier)throw ci(Vi);return this.set(t.identifier,e),e}if(vi(e)){var n=ti(this),r=n.type;if(r.identifierMode!==Ii.YES)throw ci(Vi);var i=e[r.mapIdentifierAttribute];if(!ko(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Io(i);return this.set(a,e),this.get(a)}throw ci("Map.put can only be used to store complex values")}}),t}(In),Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ii.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ii.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw ci("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ii.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ii.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Ri(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);_i(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw ci("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ti(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ii.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw ci("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ti(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return di(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return si}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Mi.prototype.applySnapshot=Et(Mi.prototype.applySnapshot);var Li=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(oi(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);_i(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Qr(e)?ti(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),uo=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw ci("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw ci("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function co(e,t,n){return function(e,t){if("function"!=typeof t&&Qr(t))throw ci("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||fo)}var fo=[void 0],po=co(to,void 0),ho=co(eo,null);function bo(e){return Dr(),so(e,po)}var vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw ci("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),yo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Jr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):gi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),go=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Jr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return gi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),_o=new go,mo=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),ko(e))this.identifier=e;else{if(!Qr(e))throw ci("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ti(e);if(!n.identifierAttribute)throw ci("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw ci("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Io(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new wo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),wo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),Oo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return ko(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ti(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Io(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),jo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Qr(r)?(ei(i=r),ti(i).identifier):r,a=new mo(r,this.targetType),u=Jr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Qr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(Oo),Po=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Qr(r)?this.options.set(r,e?e.storedValue:null):r,o=Jr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Qr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(Oo);function So(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new Po(e,{get:n.get,set:n.set},r):new jo(e,r)}var Ao=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Gi))throw ci("Identifier types can only be instantiated as direct child of a model type");return Jr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw ci("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),xo=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(Ao),Eo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(Ao),To=new xo,Co=new Eo;function Io(e){return""+e}function ko(e){return"string"==typeof e||"number"==typeof e}var No=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Jr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),Vo={enumeration:function(e,t){var n="string"==typeof e?t:e,r=so.apply(void 0,yr(n.map((function(e){return oo(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?_o:Vr(e)?new go(e):co(_o,e)},identifier:To,identifierNumber:Co,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new vo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new yo(e,t)},undefined:to,null:eo,snapshotProcessor:function(e,t,n){return Dr(),new Ni(e,t,n)}},Do=n(215),Ro=new(n.n(Do)().Suite);const Mo={};Ro.on("complete",(function(){const e=Ro.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Mo[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Ro.add("Check an invalid snapshot with MST typecheck",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=(Vo.model({id:Vo.identifier,name:Vo.string,age:Vo.number,isHappy:Vo.boolean,createdAt:Vo.Date,updatedAt:Vo.maybeNull(Vo.Date),favoriteColors:Vo.array(Vo.string),favoriteNumbers:Vo.array(Vo.number),favoriteFoods:Vo.array(Vo.model({name:Vo.string,calories:Vo.number}))}),Vo.model({id:Vo.identifier,shouldMatch:!1}));try{Kr(t,{id:"1",name:"John",age:42,isHappy:!0,createdAt:new Date,updatedAt:null,favoriteColors:["blue","green"],favoriteNumbers:[1,2,3],favoriteFoods:[{name:"Pizza",calories:1e3}]})}catch(e){return}var n,r;n="Check an invalid snapshot with MST typecheck",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Mo[n]?Mo[n]=Math.max(Mo[n],r):Mo[n]=r})),Ro.on("cycle",(function(e){console.log(String(e.target))})),Ro.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/check-an-invalid-snapshot-with-mst-typecheck-web-bundle.js.LICENSE.txt b/build/check-an-invalid-snapshot-with-mst-typecheck-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/check-an-invalid-snapshot-with-mst-typecheck-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/create-1-model-and-set-a-boolean-value-bundle-source.js b/build/create-1-model-and-set-a-boolean-value-bundle-source.js new file mode 100644 index 0000000..15fa56f --- /dev/null +++ b/build/create-1-model-and-set-a-boolean-value-bundle-source.js @@ -0,0 +1,122 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Create 1 model and set a boolean value", () => { + const startMemory = getStartMemory(); + const ModelWithPrimitivesAndActions = types + .model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, + }) + .actions((self) => ({ + setString(string) { + self.string = string; + }, + setNumber(number) { + self.number = number; + }, + setInteger(integer) { + self.integer = integer; + }, + setFloat(float) { + self.float = float; + }, + setBoolean(boolean) { + self.boolean = boolean; + }, + setDate(date) { + self.date = date; + }, + })); + +ModelWithPrimitivesAndActions.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), +}).setBoolean(false); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Create 1 model and set a boolean value", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/create-1-model-and-set-a-boolean-value-node-bundle.js b/build/create-1-model-and-set-a-boolean-value-node-bundle.js new file mode 100644 index 0000000..f611d11 --- /dev/null +++ b/build/create-1-model-and-set-a-boolean-value-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-1-model-and-set-a-boolean-value-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Ci?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Ci&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Ca=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Va={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Vi(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Create 1 model and set a boolean value",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=Va.model({string:Va.string,number:Va.number,integer:Va.integer,float:Va.float,boolean:Va.boolean,date:Va.Date}).actions((e=>({setString(t){e.string=t},setNumber(t){e.number=t},setInteger(t){e.integer=t},setFloat(t){e.float=t},setBoolean(t){e.boolean=t},setDate(t){e.date=t}})));var r,n;t.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}).setBoolean(!1),r="Create 1 model and set a boolean value",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[r]?ka[r]=Math.max(ka[r],n):ka[r]=n})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/create-1-model-and-set-a-boolean-value-node-bundle.js.LICENSE.txt b/build/create-1-model-and-set-a-boolean-value-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/create-1-model-and-set-a-boolean-value-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/create-1-model-and-set-a-boolean-value-web-bundle.js b/build/create-1-model-and-set-a-boolean-value-web-bundle.js new file mode 100644 index 0000000..53646be --- /dev/null +++ b/build/create-1-model-and-set-a-boolean-value-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-1-model-and-set-a-boolean-value-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw si("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw si(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw si("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw si("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw si("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw si(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw si("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw si("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw si("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw si("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw si("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw si(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw si(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw si("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw si("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw si("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw si("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw si("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw si("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function so(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw si("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||co)}var co=[void 0],fo=so(eo,void 0),po=so(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw si("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw si("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw si("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw si("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw si("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw si("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):so(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Create 1 model and set a boolean value",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=No.model({string:No.string,number:No.number,integer:No.integer,float:No.float,boolean:No.boolean,date:No.Date}).actions((e=>({setString(t){e.string=t},setNumber(t){e.number=t},setInteger(t){e.integer=t},setFloat(t){e.float=t},setBoolean(t){e.boolean=t},setDate(t){e.date=t}})));var n,r;t.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}).setBoolean(!1),n="Create 1 model and set a boolean value",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[n]?Ro[n]=Math.max(Ro[n],r):Ro[n]=r})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/create-1-model-and-set-a-boolean-value-web-bundle.js.LICENSE.txt b/build/create-1-model-and-set-a-boolean-value-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/create-1-model-and-set-a-boolean-value-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/create-1-model-and-set-a-boolean-value-with-applyaction-bundle-source.js b/build/create-1-model-and-set-a-boolean-value-with-applyaction-bundle-source.js new file mode 100644 index 0000000..6957232 --- /dev/null +++ b/build/create-1-model-and-set-a-boolean-value-with-applyaction-bundle-source.js @@ -0,0 +1,128 @@ + +import { applyAction, types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Create 1 model and set a boolean value with applyAction", () => { + const startMemory = getStartMemory(); + const ModelWithPrimitivesAndActions = types + .model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, + }) + .actions((self) => ({ + setString(string) { + self.string = string; + }, + setNumber(number) { + self.number = number; + }, + setInteger(integer) { + self.integer = integer; + }, + setFloat(float) { + self.float = float; + }, + setBoolean(boolean) { + self.boolean = boolean; + }, + setDate(date) { + self.date = date; + }, + })); + +const m = ModelWithPrimitivesAndActions.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), +}); + +applyAction(m, { + name: "setBoolean", + path: "", + args: [false], +}); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Create 1 model and set a boolean value with applyAction", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/create-1-model-and-set-a-boolean-value-with-applyaction-node-bundle.js b/build/create-1-model-and-set-a-boolean-value-with-applyaction-node-bundle.js new file mode 100644 index 0000000..f178217 --- /dev/null +++ b/build/create-1-model-and-set-a-boolean-value-with-applyaction-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-1-model-and-set-a-boolean-value-with-applyaction-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var H=Symbol("mobx administration"),F=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[H]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ht=ee("flow.bound",{bound:!0}),Ft=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||Fe(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[H].values_.has(t):Br(e)||!!e[H]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[H].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[H].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[H].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[H].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[H]}Ft.bound=U(Ht);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[H];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[H];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[H];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[H])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[H]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new He(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new He(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[H]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:H});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==$n.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Pn);jn.prototype.die=Tt(jn.prototype.die);var Sn,An,En=1,Tn={onError:function(e){throw e}},In=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++En}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new Xn),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw fi("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Va(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=$n.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=li,this.state=$n.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=$n.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw fi(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ii(e.subpath)||"",n=e.actionContext||Mn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(ti(i=n.context,1),ri(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(li),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):oi(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw fi("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw fi("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Un(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=Vi(t.path);ai(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Un(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),_i(this.storedValue,"$treenode",this),_i(this.storedValue,"toJSON",ii)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==$n.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),Tn);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new Oi),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Mn,zn=1;function Un(e,t,r){var n=function(){var n=zn++,i=Mn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ri(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Mn;Mn=e;try{return function(e,t,r){var n=new Bn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Mn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:Pi(arguments),context:e,tree:On(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var Bn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Hn(e){return"function"==typeof e?"":ei(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=ei(t)?"value of type "+ri(t).type.name+":":gi(t)?"value":"snapshot",o=r&&ei(t)&&r.is(ri(t).snapshot);return""+i+a+" "+Hn(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return kn(e)&&(e.flags&(An.String|An.Number|An.Integer|An.Boolean|An.Date))>0}(r)||gi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Gn(e,t,r){return e.concat([{path:t,type:r}])}function Kn(){return si}function Wn(e,t,r){return[{context:e,value:t,message:r}]}function qn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Yn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw fi(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Hn(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Fn).join("\n ")}(e,t,r))}(e,t)}var $n,Jn=0,Xn=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Jn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],ci));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw fi("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw fi("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Zn(e,t,r,n,i){var a=ni(i);if(a){if(a.parent)throw fi("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new In(e,t,r,n,i)}function Qn(e,t,r,n,i){return new jn(e,t,r,n,i)}function ei(e){return!(!e||!e.$treenode)}function ti(e,t){Si()}function ri(e){if(!ei(e))throw fi("Value "+e+" is no MST Node");return e.$treenode}function ni(e){return e&&e.$treenode||null}function ii(){return ri(this).snapshot}function ai(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=ei(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,ei(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Di?Wn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=kn(e)?this._subtype:ei(e)?wn(e,!1):this.preProcessSnapshotSafe(e);return t!==Di&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof xn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Vn),Ri="Map.put can only be used to store complex values that have an identifier type attribute";function Li(e,t){var r,n,i=e.getSubTypes();if(i===Nn)return!1;if(i){var a=di(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Li(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Yi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(xi||(xi={}));var Mi=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw fi("Map.put cannot be used to set empty values");if(ei(e)){var t=ri(e);if(null===t.identifier)throw fi(Ri);return this.set(t.identifier,e),e}if(yi(e)){var r=ri(this),n=r.type;if(n.identifierMode!==xi.YES)throw fi(Ri);var i=e[n.mapIdentifierAttribute];if(!xa(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(wn(a))}var o=Va(i);return this.set(o,e),this.get(o)}throw fi("Map.put can only be used to store complex values")}}),t}(Nr),zi=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:xi.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Zn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===xi.UNKNOWN){var e=[];if(Li(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw fi("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=xi.YES,this.mapIdentifierAttribute=t):this.identifierMode=xi.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Mi(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Un(t,e,n);_i(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw fi("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ri(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Yn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Yn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===xi.YES&&t instanceof In){var r=t.identifier;if(r!==e)throw fi("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ri(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ii(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ii(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ii(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Yn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return vi(e)?qn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Gn(t,n,r._subType))}))):Wn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return li}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(xn);zi.prototype.applySnapshot=Tt(zi.prototype.applySnapshot);var Ui=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Zn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},ci),{name:this.name});return Ae.array(oi(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Un(t,e,n);_i(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=ei(e)?ri(e).snapshot:e;return this._predicate(n)?Kn():Wn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn),la=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=An.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw fi("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw fi("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Yn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Kn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn);function pa(e,t,r){return function(e,t){if("function"!=typeof t&&ei(t))throw fi("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Rn()}(0,t),new fa(e,t,r||ba)}var ba=[void 0],ha=pa(na,void 0),da=pa(ra,null);function va(e){return Rn(),ca(e,ha)}var ya=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|An.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw fi("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Kn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Nn}}),t}(Vn),ga=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Qn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):mi(e)?Kn():Wn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(Dn),ma=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Qn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return mi(e)?this.subType?this.subType.validate(e,t):Kn():Wn(t,e,"Value is not serializable and cannot be frozen")}}),t}(Dn),_a=new ma,wa=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),xa(e))this.identifier=e;else{if(!ei(e))throw fi("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ri(e);if(!r.identifierAttribute)throw fi("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw fi("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Va(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new Oa("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),Oa=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),Pa=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return xa(e)?Kn():Wn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;kn(e=i.type)&&(e.flags&An.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ri(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Va(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===$n.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(Dn),ja=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=ei(n)?(ti(i=n),ri(i).identifier):n,o=new wa(n,this.targetType),u=Qn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=ei(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(Pa),Sa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=ei(n)?this.options.set(n,e?e.storedValue:null):n,a=Qn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=ei(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(Pa);function Aa(e,t){Rn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Sa(e,{get:r.get,set:r.set},n):new ja(e,n)}var Ea=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Yi))throw fi("Identifier types can only be instantiated as direct child of a model type");return Qn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw fi("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Wn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Kn()}}),t}(Dn),Ta=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(Ea),Ia=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(Ea),Na=new Ta,Ca=new Ia;function Va(e){return""+e}function xa(e){return"string"==typeof e||"number"==typeof e}var Da=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Kn();var r=this.options.getValidationMessage(e);return r?Wn(t,e,"Invalid value for type '"+this.name+"': "+r):Kn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Qn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(Dn),ka={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ca.apply(void 0,yn(r.map((function(e){return ua(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Rn(),new Ui(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?_a:kn(e)?new ma(e):pa(_a,e)},identifier:Na,identifierNumber:Ca,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ya(r,"string"==typeof e?t:e)},lazy:function(e,t){return new ga(e,t)},undefined:na,null:ra,snapshotProcessor:function(e,t,r){return Rn(),new ki(e,t,r)}};const Ra=require("benchmark");var La=new(e.n(Ra)().Suite);const Ma={};La.on("complete",(function(){const e=La.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ma[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),La.add("Create 1 model and set a boolean value with applyAction",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=ka.model({string:ka.string,number:ka.number,integer:ka.integer,float:ka.float,boolean:ka.boolean,date:ka.Date}).actions((e=>({setString(t){e.string=t},setNumber(t){e.number=t},setInteger(t){e.integer=t},setFloat(t){e.float=t},setBoolean(t){e.boolean=t},setDate(t){e.date=t}})));var r,n;Ln(t.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}),{name:"setBoolean",path:"",args:[!1]}),r="Create 1 model and set a boolean value with applyAction",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ma[r]?Ma[r]=Math.max(Ma[r],n):Ma[r]=n})),La.on("cycle",(function(e){console.log(String(e.target))})),La.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/create-1-model-and-set-a-boolean-value-with-applyaction-node-bundle.js.LICENSE.txt b/build/create-1-model-and-set-a-boolean-value-with-applyaction-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/create-1-model-and-set-a-boolean-value-with-applyaction-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/create-1-model-and-set-a-boolean-value-with-applyaction-web-bundle.js b/build/create-1-model-and-set-a-boolean-value-with-applyaction-web-bundle.js new file mode 100644 index 0000000..bf1c1c4 --- /dev/null +++ b/build/create-1-model-and-set-a-boolean-value-with-applyaction-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-1-model-and-set-a-boolean-value-with-applyaction-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,P=a.floor,j=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:j(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=j(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,P=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,P.elapsed=(m-P.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,P.cycle=f*e.count,P.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",P="[object Number]",j="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Pe="\\u2700-\\u27bf",je="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+Pe+"]",Ne="["+je+"]",Ve="[^"+we+xe+Ie+Pe+je+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[P]=it[j]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[P]=ot[j]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function Pt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function jt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,Pe=t.Math,je=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=je.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(je),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(je.getPrototypeOf,je),He=je.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(je,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=Pe.ceil,ht=Pe.floor,dt=je.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(je.keys,je),vn=Pe.max,yn=Pe.min,gn=ie.now,_n=t.parseInt,mn=Pe.random,wn=Ee.reverse,On=lo(t,"DataView"),Pn=lo(t,"Map"),jn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(je,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(Pn),kn=Mo(jn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==j||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case P:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?je(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=je(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(Pn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!Pn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in je(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(jo(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Pi(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=je(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return Pt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?Pt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var Pa=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),ja=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&Pr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&Pr(e)==g};function Xa(e){if(!eu(e))return!1;var t=Pr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=Pr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&Pr(e)==P}function ru(e){if(!eu(e)||Pr(e)!=j)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&Pr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&Pr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&Pr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[Pr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),Pu=Kr((function(e,t){e=je(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return Pt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),Pl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),Pt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==Pr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,jr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),jr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:Pt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,Pt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(jt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,Pn,jn=P("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&jn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,Pn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):j(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(j(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Pn,get:function(){return"Map"}}]),t}(),kn=P("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():j(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Xr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Pr);jr.prototype.die=Et(jr.prototype.die);var Sr,Ar,xr=1,Er={onError:function(e){throw e}},Tr=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++xr}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Zr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw fi("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=No(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Xr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=si,this.state=Xr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Xr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw fi(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&Ti(e.subpath)||"",r=e.actionContext||Lr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(ti(i=r.context,1),ni(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(si),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ai(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw fi("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw fi("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Br(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=ki(t.path);oi(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Br(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),mi(this.storedValue,"$treenode",this),mi(this.storedValue,"toJSON",ii)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Xr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),Er);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new Oi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Lr,zr=1;function Br(e,t,n){var r=function(){var r=zr++,i=Lr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ni(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Lr;Lr=e;try{return function(e,t,n){var r=new Fr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Lr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:Pi(arguments),context:e,tree:Or(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var Fr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Ur(e){return"function"==typeof e?"":ei(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Wr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=ei(t)?"value of type "+ni(t).type.name+":":gi(t)?"value":"snapshot",a=n&&ei(t)&&n.is(ni(t).snapshot);return""+i+o+" "+Ur(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Dr(e)&&(e.flags&(Ar.String|Ar.Number|Ar.Integer|Ar.Boolean|Ar.Date))>0}(n)||gi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function $r(e,t,n){return e.concat([{path:t,type:n}])}function Hr(){return li}function Gr(e,t,n){return[{context:e,value:t,message:n}]}function Kr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function qr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw fi(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Ur(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Wr).join("\n ")}(e,t,n))}(e,t)}var Xr,Yr=0,Zr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],ci));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw fi("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw fi("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Jr(e,t,n,r,i){var o=ri(i);if(o){if(o.parent)throw fi("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Tr(e,t,n,r,i)}function Qr(e,t,n,r,i){return new jr(e,t,n,r,i)}function ei(e){return!(!e||!e.$treenode)}function ti(e,t){Si()}function ni(e){if(!ei(e))throw fi("Value "+e+" is no MST Node");return e.$treenode}function ri(e){return e&&e.$treenode||null}function ii(){return ni(this).snapshot}function oi(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=ei(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,ei(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Vi?Gr(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dr(e)?this._subtype:ei(e)?wr(e,!1):this.preProcessSnapshotSafe(e);return t!==Vi&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Nr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(kr),Ri="Map.put can only be used to store complex values that have an identifier type attribute";function Mi(e,t){var n,r,i=e.getSubTypes();if(i===Cr)return!1;if(i){var o=di(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Mi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof qi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var Li=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw fi("Map.put cannot be used to set empty values");if(ei(e)){var t=ni(e);if(null===t.identifier)throw fi(Ri);return this.set(t.identifier,e),e}if(yi(e)){var n=ni(this),r=n.type;if(r.identifierMode!==Ni.YES)throw fi(Ri);var i=e[r.mapIdentifierAttribute];if(!Vo(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(wr(o))}var a=No(i);return this.set(a,e),this.get(a)}throw fi("Map.put can only be used to store complex values")}}),t}(In),zi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Jr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Mi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw fi("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Li(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Br(t,e,r);mi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw fi("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ni(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;qr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":qr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tr){var n=t.identifier;if(n!==e)throw fi("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ni(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ti(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ti(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ti(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){qr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return vi(e)?Kr(Object.keys(e).map((function(r){return n._subType.validate(e[r],$r(t,r,n._subType))}))):Gr(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return si}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Nr);zi.prototype.applySnapshot=Et(zi.prototype.applySnapshot);var Bi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Jr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},ci),{name:this.name});return Ae.array(ai(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Br(t,e,r);mi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=ei(e)?ni(e).snapshot:e;return this._predicate(r)?Hr():Gr(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(kr),so=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Ar.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw fi("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw fi("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&qr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(kr);function po(e,t,n){return function(e,t){if("function"!=typeof t&&ei(t))throw fi("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Rr()}(0,t),new fo(e,t,n||ho)}var ho=[void 0],bo=po(ro,void 0),vo=po(no,null);function yo(e){return Rr(),co(e,bo)}var go=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Ar.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw fi("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Hr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Cr}}),t}(kr),_o=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Qr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):_i(e)?Hr():Gr(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Vr),mo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Qr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return _i(e)?this.subType?this.subType.validate(e,t):Hr():Gr(t,e,"Value is not serializable and cannot be frozen")}}),t}(Vr),wo=new mo,Oo=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Vo(e))this.identifier=e;else{if(!ei(e))throw fi("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ni(e);if(!n.identifierAttribute)throw fi("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw fi("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=No(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new Po("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),Po=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),jo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Vo(e)?Hr():Gr(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dr(e=i.type)&&(e.flags&Ar.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ni(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,No(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Xr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Vr),So=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=ei(r)?(ti(i=r),ni(i).identifier):r,a=new Oo(r,this.targetType),u=Qr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=ei(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(jo),Ao=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=ei(r)?this.options.set(r,e?e.storedValue:null):r,o=Qr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=ei(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(jo);function xo(e,t){Rr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new Ao(e,{get:n.get,set:n.set},r):new So(e,r)}var Eo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof qi))throw fi("Identifier types can only be instantiated as direct child of a model type");return Qr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw fi("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gr(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hr()}}),t}(Vr),To=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(Eo),Co=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(Eo),Io=new To,ko=new Co;function No(e){return""+e}function Vo(e){return"string"==typeof e||"number"==typeof e}var Do=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hr();var n=this.options.getValidationMessage(e);return n?Gr(t,e,"Invalid value for type '"+this.name+"': "+n):Hr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Qr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Vr),Ro={enumeration:function(e,t){var n="string"==typeof e?t:e,r=co.apply(void 0,yr(n.map((function(e){return uo(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Rr(),new Bi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?wo:Dr(e)?new mo(e):po(wo,e)},identifier:Io,identifierNumber:ko,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new go(n,"string"==typeof e?t:e)},lazy:function(e,t){return new _o(e,t)},undefined:ro,null:no,snapshotProcessor:function(e,t,n){return Rr(),new Di(e,t,n)}},Mo=n(215),Lo=new(n.n(Mo)().Suite);const zo={};Lo.on("complete",(function(){const e=Lo.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:zo[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Lo.add("Create 1 model and set a boolean value with applyAction",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=Ro.model({string:Ro.string,number:Ro.number,integer:Ro.integer,float:Ro.float,boolean:Ro.boolean,date:Ro.Date}).actions((e=>({setString(t){e.string=t},setNumber(t){e.number=t},setInteger(t){e.integer=t},setFloat(t){e.float=t},setBoolean(t){e.boolean=t},setDate(t){e.date=t}})));var n,r;Mr(t.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}),{name:"setBoolean",path:"",args:[!1]}),n="Create 1 model and set a boolean value with applyAction",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,zo[n]?zo[n]=Math.max(zo[n],r):zo[n]=r})),Lo.on("cycle",(function(e){console.log(String(e.target))})),Lo.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/create-1-model-and-set-a-boolean-value-with-applyaction-web-bundle.js.LICENSE.txt b/build/create-1-model-and-set-a-boolean-value-with-applyaction-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/create-1-model-and-set-a-boolean-value-with-applyaction-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/create-1-model-and-set-a-date-value-bundle-source.js b/build/create-1-model-and-set-a-date-value-bundle-source.js new file mode 100644 index 0000000..e4d5f04 --- /dev/null +++ b/build/create-1-model-and-set-a-date-value-bundle-source.js @@ -0,0 +1,122 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Create 1 model and set a date value", () => { + const startMemory = getStartMemory(); + const ModelWithPrimitivesAndActions = types + .model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, + }) + .actions((self) => ({ + setString(string) { + self.string = string; + }, + setNumber(number) { + self.number = number; + }, + setInteger(integer) { + self.integer = integer; + }, + setFloat(float) { + self.float = float; + }, + setBoolean(boolean) { + self.boolean = boolean; + }, + setDate(date) { + self.date = date; + }, + })); + +ModelWithPrimitivesAndActions.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), +}).setDate(new Date()); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Create 1 model and set a date value", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/create-1-model-and-set-a-date-value-node-bundle.js b/build/create-1-model-and-set-a-date-value-node-bundle.js new file mode 100644 index 0000000..5d0db6a --- /dev/null +++ b/build/create-1-model-and-set-a-date-value-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-1-model-and-set-a-date-value-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Ci?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Ci&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Ca=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Va={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Vi(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Create 1 model and set a date value",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=Va.model({string:Va.string,number:Va.number,integer:Va.integer,float:Va.float,boolean:Va.boolean,date:Va.Date}).actions((e=>({setString(t){e.string=t},setNumber(t){e.number=t},setInteger(t){e.integer=t},setFloat(t){e.float=t},setBoolean(t){e.boolean=t},setDate(t){e.date=t}})));var r,n;t.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}).setDate(new Date),r="Create 1 model and set a date value",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[r]?ka[r]=Math.max(ka[r],n):ka[r]=n})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/create-1-model-and-set-a-date-value-node-bundle.js.LICENSE.txt b/build/create-1-model-and-set-a-date-value-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/create-1-model-and-set-a-date-value-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/create-1-model-and-set-a-date-value-web-bundle.js b/build/create-1-model-and-set-a-date-value-web-bundle.js new file mode 100644 index 0000000..5ea0ea6 --- /dev/null +++ b/build/create-1-model-and-set-a-date-value-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-1-model-and-set-a-date-value-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw si("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw si(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw si("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw si("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw si("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw si(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw si("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw si("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw si("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw si("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw si("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw si(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw si(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw si("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw si("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw si("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw si("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw si("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw si("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function so(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw si("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||co)}var co=[void 0],fo=so(eo,void 0),po=so(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw si("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw si("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw si("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw si("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw si("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw si("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):so(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Create 1 model and set a date value",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=No.model({string:No.string,number:No.number,integer:No.integer,float:No.float,boolean:No.boolean,date:No.Date}).actions((e=>({setString(t){e.string=t},setNumber(t){e.number=t},setInteger(t){e.integer=t},setFloat(t){e.float=t},setBoolean(t){e.boolean=t},setDate(t){e.date=t}})));var n,r;t.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}).setDate(new Date),n="Create 1 model and set a date value",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[n]?Ro[n]=Math.max(Ro[n],r):Ro[n]=r})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/create-1-model-and-set-a-date-value-web-bundle.js.LICENSE.txt b/build/create-1-model-and-set-a-date-value-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/create-1-model-and-set-a-date-value-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/create-1-model-and-set-a-float-value-with-applyaction-bundle-source.js b/build/create-1-model-and-set-a-float-value-with-applyaction-bundle-source.js new file mode 100644 index 0000000..bf562c2 --- /dev/null +++ b/build/create-1-model-and-set-a-float-value-with-applyaction-bundle-source.js @@ -0,0 +1,128 @@ + +import { applyAction, types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Create 1 model and set a float value with applyAction", () => { + const startMemory = getStartMemory(); + const ModelWithPrimitivesAndActions = types + .model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, + }) + .actions((self) => ({ + setString(string) { + self.string = string; + }, + setNumber(number) { + self.number = number; + }, + setInteger(integer) { + self.integer = integer; + }, + setFloat(float) { + self.float = float; + }, + setBoolean(boolean) { + self.boolean = boolean; + }, + setDate(date) { + self.date = date; + }, + })); + +const m = ModelWithPrimitivesAndActions.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), +}); + +applyAction(m, { + name: "setFloat", + path: "", + args: [2.2], +}); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Create 1 model and set a float value with applyAction", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/create-1-model-and-set-a-float-value-with-applyaction-node-bundle.js b/build/create-1-model-and-set-a-float-value-with-applyaction-node-bundle.js new file mode 100644 index 0000000..193d699 --- /dev/null +++ b/build/create-1-model-and-set-a-float-value-with-applyaction-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-1-model-and-set-a-float-value-with-applyaction-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==$n.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Pn);jn.prototype.die=Tt(jn.prototype.die);var Sn,An,En=1,Tn={onError:function(e){throw e}},In=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++En}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new Xn),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw fi("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Va(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=$n.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=li,this.state=$n.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=$n.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw fi(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ii(e.subpath)||"",n=e.actionContext||Mn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(ti(i=n.context,1),ri(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(li),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):oi(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw fi("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw fi("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Un(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=Vi(t.path);ai(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Un(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),_i(this.storedValue,"$treenode",this),_i(this.storedValue,"toJSON",ii)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==$n.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),Tn);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new Oi),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Mn,zn=1;function Un(e,t,r){var n=function(){var n=zn++,i=Mn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ri(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Mn;Mn=e;try{return function(e,t,r){var n=new Bn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Mn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:Pi(arguments),context:e,tree:On(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var Bn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Fn(e){return"function"==typeof e?"":ei(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Hn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=ei(t)?"value of type "+ri(t).type.name+":":gi(t)?"value":"snapshot",o=r&&ei(t)&&r.is(ri(t).snapshot);return""+i+a+" "+Fn(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return kn(e)&&(e.flags&(An.String|An.Number|An.Integer|An.Boolean|An.Date))>0}(r)||gi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Gn(e,t,r){return e.concat([{path:t,type:r}])}function Kn(){return si}function Wn(e,t,r){return[{context:e,value:t,message:r}]}function qn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Yn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw fi(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Fn(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Hn).join("\n ")}(e,t,r))}(e,t)}var $n,Jn=0,Xn=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Jn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],ci));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw fi("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw fi("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Zn(e,t,r,n,i){var a=ni(i);if(a){if(a.parent)throw fi("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new In(e,t,r,n,i)}function Qn(e,t,r,n,i){return new jn(e,t,r,n,i)}function ei(e){return!(!e||!e.$treenode)}function ti(e,t){Si()}function ri(e){if(!ei(e))throw fi("Value "+e+" is no MST Node");return e.$treenode}function ni(e){return e&&e.$treenode||null}function ii(){return ri(this).snapshot}function ai(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=ei(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,ei(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Di?Wn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=kn(e)?this._subtype:ei(e)?wn(e,!1):this.preProcessSnapshotSafe(e);return t!==Di&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof xn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Vn),Ri="Map.put can only be used to store complex values that have an identifier type attribute";function Li(e,t){var r,n,i=e.getSubTypes();if(i===Nn)return!1;if(i){var a=di(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Li(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Yi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(xi||(xi={}));var Mi=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw fi("Map.put cannot be used to set empty values");if(ei(e)){var t=ri(e);if(null===t.identifier)throw fi(Ri);return this.set(t.identifier,e),e}if(yi(e)){var r=ri(this),n=r.type;if(n.identifierMode!==xi.YES)throw fi(Ri);var i=e[n.mapIdentifierAttribute];if(!xa(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(wn(a))}var o=Va(i);return this.set(o,e),this.get(o)}throw fi("Map.put can only be used to store complex values")}}),t}(Nr),zi=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:xi.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Zn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===xi.UNKNOWN){var e=[];if(Li(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw fi("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=xi.YES,this.mapIdentifierAttribute=t):this.identifierMode=xi.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Mi(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Un(t,e,n);_i(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw fi("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ri(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Yn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Yn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===xi.YES&&t instanceof In){var r=t.identifier;if(r!==e)throw fi("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ri(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ii(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ii(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ii(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Yn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return vi(e)?qn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Gn(t,n,r._subType))}))):Wn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return li}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(xn);zi.prototype.applySnapshot=Tt(zi.prototype.applySnapshot);var Ui=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Zn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},ci),{name:this.name});return Ae.array(oi(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Un(t,e,n);_i(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=ei(e)?ri(e).snapshot:e;return this._predicate(n)?Kn():Wn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn),la=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=An.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw fi("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw fi("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Yn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Kn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn);function pa(e,t,r){return function(e,t){if("function"!=typeof t&&ei(t))throw fi("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Rn()}(0,t),new fa(e,t,r||ba)}var ba=[void 0],ha=pa(na,void 0),da=pa(ra,null);function va(e){return Rn(),ca(e,ha)}var ya=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|An.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw fi("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Kn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Nn}}),t}(Vn),ga=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Qn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):mi(e)?Kn():Wn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(Dn),ma=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Qn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return mi(e)?this.subType?this.subType.validate(e,t):Kn():Wn(t,e,"Value is not serializable and cannot be frozen")}}),t}(Dn),_a=new ma,wa=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),xa(e))this.identifier=e;else{if(!ei(e))throw fi("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ri(e);if(!r.identifierAttribute)throw fi("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw fi("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Va(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new Oa("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),Oa=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),Pa=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return xa(e)?Kn():Wn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;kn(e=i.type)&&(e.flags&An.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ri(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Va(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===$n.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(Dn),ja=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=ei(n)?(ti(i=n),ri(i).identifier):n,o=new wa(n,this.targetType),u=Qn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=ei(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(Pa),Sa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=ei(n)?this.options.set(n,e?e.storedValue:null):n,a=Qn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=ei(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(Pa);function Aa(e,t){Rn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Sa(e,{get:r.get,set:r.set},n):new ja(e,n)}var Ea=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Yi))throw fi("Identifier types can only be instantiated as direct child of a model type");return Qn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw fi("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Wn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Kn()}}),t}(Dn),Ta=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(Ea),Ia=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(Ea),Na=new Ta,Ca=new Ia;function Va(e){return""+e}function xa(e){return"string"==typeof e||"number"==typeof e}var Da=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Kn();var r=this.options.getValidationMessage(e);return r?Wn(t,e,"Invalid value for type '"+this.name+"': "+r):Kn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Qn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(Dn),ka={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ca.apply(void 0,yn(r.map((function(e){return ua(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Rn(),new Ui(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?_a:kn(e)?new ma(e):pa(_a,e)},identifier:Na,identifierNumber:Ca,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ya(r,"string"==typeof e?t:e)},lazy:function(e,t){return new ga(e,t)},undefined:na,null:ra,snapshotProcessor:function(e,t,r){return Rn(),new ki(e,t,r)}};const Ra=require("benchmark");var La=new(e.n(Ra)().Suite);const Ma={};La.on("complete",(function(){const e=La.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ma[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),La.add("Create 1 model and set a float value with applyAction",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=ka.model({string:ka.string,number:ka.number,integer:ka.integer,float:ka.float,boolean:ka.boolean,date:ka.Date}).actions((e=>({setString(t){e.string=t},setNumber(t){e.number=t},setInteger(t){e.integer=t},setFloat(t){e.float=t},setBoolean(t){e.boolean=t},setDate(t){e.date=t}})));var r,n;Ln(t.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}),{name:"setFloat",path:"",args:[2.2]}),r="Create 1 model and set a float value with applyAction",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ma[r]?Ma[r]=Math.max(Ma[r],n):Ma[r]=n})),La.on("cycle",(function(e){console.log(String(e.target))})),La.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/create-1-model-and-set-a-float-value-with-applyaction-node-bundle.js.LICENSE.txt b/build/create-1-model-and-set-a-float-value-with-applyaction-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/create-1-model-and-set-a-float-value-with-applyaction-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/create-1-model-and-set-a-float-value-with-applyaction-web-bundle.js b/build/create-1-model-and-set-a-float-value-with-applyaction-web-bundle.js new file mode 100644 index 0000000..0335ceb --- /dev/null +++ b/build/create-1-model-and-set-a-float-value-with-applyaction-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-1-model-and-set-a-float-value-with-applyaction-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,P=a.floor,j=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:j(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=j(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,P=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,P.elapsed=(m-P.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,P.cycle=f*e.count,P.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",P="[object Number]",j="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Pe="\\u2700-\\u27bf",je="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+Pe+"]",Ne="["+je+"]",Ve="[^"+we+xe+Ie+Pe+je+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[P]=it[j]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[P]=ot[j]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function Pt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function jt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,Pe=t.Math,je=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=je.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(je),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(je.getPrototypeOf,je),He=je.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(je,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=Pe.ceil,ht=Pe.floor,dt=je.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(je.keys,je),vn=Pe.max,yn=Pe.min,gn=ie.now,_n=t.parseInt,mn=Pe.random,wn=Ee.reverse,On=lo(t,"DataView"),Pn=lo(t,"Map"),jn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(je,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(Pn),kn=Mo(jn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==j||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case P:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?je(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=je(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(Pn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!Pn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in je(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(jo(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Pi(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=je(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return Pt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?Pt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var Pa=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),ja=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&Pr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&Pr(e)==g};function Xa(e){if(!eu(e))return!1;var t=Pr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=Pr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&Pr(e)==P}function ru(e){if(!eu(e)||Pr(e)!=j)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&Pr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&Pr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&Pr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[Pr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),Pu=Kr((function(e,t){e=je(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return Pt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),Pl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),Pt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==Pr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,jr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),jr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:Pt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,Pt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(jt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,Pn,jn=P("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&jn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,Pn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):j(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(j(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Pn,get:function(){return"Map"}}]),t}(),kn=P("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():j(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Xr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Pr);jr.prototype.die=Et(jr.prototype.die);var Sr,Ar,xr=1,Er={onError:function(e){throw e}},Tr=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++xr}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Zr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw fi("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=No(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Xr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=si,this.state=Xr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Xr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw fi(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&Ti(e.subpath)||"",r=e.actionContext||Lr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(ti(i=r.context,1),ni(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(si),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ai(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw fi("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw fi("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Br(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=ki(t.path);oi(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Br(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),mi(this.storedValue,"$treenode",this),mi(this.storedValue,"toJSON",ii)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Xr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),Er);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new Oi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Lr,zr=1;function Br(e,t,n){var r=function(){var r=zr++,i=Lr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ni(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Lr;Lr=e;try{return function(e,t,n){var r=new Fr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Lr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:Pi(arguments),context:e,tree:Or(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var Fr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Ur(e){return"function"==typeof e?"":ei(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Wr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=ei(t)?"value of type "+ni(t).type.name+":":gi(t)?"value":"snapshot",a=n&&ei(t)&&n.is(ni(t).snapshot);return""+i+o+" "+Ur(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Dr(e)&&(e.flags&(Ar.String|Ar.Number|Ar.Integer|Ar.Boolean|Ar.Date))>0}(n)||gi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function $r(e,t,n){return e.concat([{path:t,type:n}])}function Hr(){return li}function Gr(e,t,n){return[{context:e,value:t,message:n}]}function Kr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function qr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw fi(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Ur(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Wr).join("\n ")}(e,t,n))}(e,t)}var Xr,Yr=0,Zr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],ci));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw fi("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw fi("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Jr(e,t,n,r,i){var o=ri(i);if(o){if(o.parent)throw fi("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Tr(e,t,n,r,i)}function Qr(e,t,n,r,i){return new jr(e,t,n,r,i)}function ei(e){return!(!e||!e.$treenode)}function ti(e,t){Si()}function ni(e){if(!ei(e))throw fi("Value "+e+" is no MST Node");return e.$treenode}function ri(e){return e&&e.$treenode||null}function ii(){return ni(this).snapshot}function oi(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=ei(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,ei(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Vi?Gr(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dr(e)?this._subtype:ei(e)?wr(e,!1):this.preProcessSnapshotSafe(e);return t!==Vi&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Nr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(kr),Ri="Map.put can only be used to store complex values that have an identifier type attribute";function Mi(e,t){var n,r,i=e.getSubTypes();if(i===Cr)return!1;if(i){var o=di(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Mi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof qi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var Li=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw fi("Map.put cannot be used to set empty values");if(ei(e)){var t=ni(e);if(null===t.identifier)throw fi(Ri);return this.set(t.identifier,e),e}if(yi(e)){var n=ni(this),r=n.type;if(r.identifierMode!==Ni.YES)throw fi(Ri);var i=e[r.mapIdentifierAttribute];if(!Vo(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(wr(o))}var a=No(i);return this.set(a,e),this.get(a)}throw fi("Map.put can only be used to store complex values")}}),t}(In),zi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Jr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Mi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw fi("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Li(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Br(t,e,r);mi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw fi("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ni(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;qr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":qr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tr){var n=t.identifier;if(n!==e)throw fi("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ni(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ti(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ti(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ti(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){qr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return vi(e)?Kr(Object.keys(e).map((function(r){return n._subType.validate(e[r],$r(t,r,n._subType))}))):Gr(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return si}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Nr);zi.prototype.applySnapshot=Et(zi.prototype.applySnapshot);var Bi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Jr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},ci),{name:this.name});return Ae.array(ai(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Br(t,e,r);mi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=ei(e)?ni(e).snapshot:e;return this._predicate(r)?Hr():Gr(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(kr),so=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Ar.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw fi("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw fi("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&qr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(kr);function po(e,t,n){return function(e,t){if("function"!=typeof t&&ei(t))throw fi("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Rr()}(0,t),new fo(e,t,n||ho)}var ho=[void 0],bo=po(ro,void 0),vo=po(no,null);function yo(e){return Rr(),co(e,bo)}var go=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Ar.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw fi("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Hr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Cr}}),t}(kr),_o=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Qr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):_i(e)?Hr():Gr(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Vr),mo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Qr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return _i(e)?this.subType?this.subType.validate(e,t):Hr():Gr(t,e,"Value is not serializable and cannot be frozen")}}),t}(Vr),wo=new mo,Oo=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Vo(e))this.identifier=e;else{if(!ei(e))throw fi("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ni(e);if(!n.identifierAttribute)throw fi("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw fi("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=No(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new Po("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),Po=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),jo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Vo(e)?Hr():Gr(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dr(e=i.type)&&(e.flags&Ar.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ni(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,No(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Xr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Vr),So=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=ei(r)?(ti(i=r),ni(i).identifier):r,a=new Oo(r,this.targetType),u=Qr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=ei(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(jo),Ao=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=ei(r)?this.options.set(r,e?e.storedValue:null):r,o=Qr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=ei(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(jo);function xo(e,t){Rr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new Ao(e,{get:n.get,set:n.set},r):new So(e,r)}var Eo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof qi))throw fi("Identifier types can only be instantiated as direct child of a model type");return Qr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw fi("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gr(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hr()}}),t}(Vr),To=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(Eo),Co=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(Eo),Io=new To,ko=new Co;function No(e){return""+e}function Vo(e){return"string"==typeof e||"number"==typeof e}var Do=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hr();var n=this.options.getValidationMessage(e);return n?Gr(t,e,"Invalid value for type '"+this.name+"': "+n):Hr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Qr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Vr),Ro={enumeration:function(e,t){var n="string"==typeof e?t:e,r=co.apply(void 0,yr(n.map((function(e){return uo(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Rr(),new Bi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?wo:Dr(e)?new mo(e):po(wo,e)},identifier:Io,identifierNumber:ko,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new go(n,"string"==typeof e?t:e)},lazy:function(e,t){return new _o(e,t)},undefined:ro,null:no,snapshotProcessor:function(e,t,n){return Rr(),new Di(e,t,n)}},Mo=n(215),Lo=new(n.n(Mo)().Suite);const zo={};Lo.on("complete",(function(){const e=Lo.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:zo[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Lo.add("Create 1 model and set a float value with applyAction",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=Ro.model({string:Ro.string,number:Ro.number,integer:Ro.integer,float:Ro.float,boolean:Ro.boolean,date:Ro.Date}).actions((e=>({setString(t){e.string=t},setNumber(t){e.number=t},setInteger(t){e.integer=t},setFloat(t){e.float=t},setBoolean(t){e.boolean=t},setDate(t){e.date=t}})));var n,r;Mr(t.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}),{name:"setFloat",path:"",args:[2.2]}),n="Create 1 model and set a float value with applyAction",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,zo[n]?zo[n]=Math.max(zo[n],r):zo[n]=r})),Lo.on("cycle",(function(e){console.log(String(e.target))})),Lo.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/create-1-model-and-set-a-float-value-with-applyaction-web-bundle.js.LICENSE.txt b/build/create-1-model-and-set-a-float-value-with-applyaction-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/create-1-model-and-set-a-float-value-with-applyaction-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/create-1-model-and-set-a-integer-value-with-applyaction-bundle-source.js b/build/create-1-model-and-set-a-integer-value-with-applyaction-bundle-source.js new file mode 100644 index 0000000..1ee23ea --- /dev/null +++ b/build/create-1-model-and-set-a-integer-value-with-applyaction-bundle-source.js @@ -0,0 +1,128 @@ + +import { applyAction, types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Create 1 model and set a integer value with applyAction", () => { + const startMemory = getStartMemory(); + const ModelWithPrimitivesAndActions = types + .model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, + }) + .actions((self) => ({ + setString(string) { + self.string = string; + }, + setNumber(number) { + self.number = number; + }, + setInteger(integer) { + self.integer = integer; + }, + setFloat(float) { + self.float = float; + }, + setBoolean(boolean) { + self.boolean = boolean; + }, + setDate(date) { + self.date = date; + }, + })); + +const m = ModelWithPrimitivesAndActions.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), +}); + +applyAction(m, { + name: "setInteger", + path: "", + args: [2], +}); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Create 1 model and set a integer value with applyAction", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/create-1-model-and-set-a-integer-value-with-applyaction-node-bundle.js b/build/create-1-model-and-set-a-integer-value-with-applyaction-node-bundle.js new file mode 100644 index 0000000..24efe52 --- /dev/null +++ b/build/create-1-model-and-set-a-integer-value-with-applyaction-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-1-model-and-set-a-integer-value-with-applyaction-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var H=Symbol("mobx administration"),F=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[H]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ht=ee("flow.bound",{bound:!0}),Ft=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||Fe(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[H].values_.has(t):Br(e)||!!e[H]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[H].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[H].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[H].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[H].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[H]}Ft.bound=U(Ht);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[H];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[H];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[H];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[H])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[H]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new He(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new He(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[H]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:H});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==$n.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Pn);jn.prototype.die=Tt(jn.prototype.die);var Sn,An,En=1,Tn={onError:function(e){throw e}},In=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++En}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new Xn),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw fi("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Va(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=$n.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=li,this.state=$n.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=$n.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw fi(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ii(e.subpath)||"",n=e.actionContext||Mn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(ti(i=n.context,1),ri(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(li),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):oi(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw fi("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw fi("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Un(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=Vi(t.path);ai(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Un(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),_i(this.storedValue,"$treenode",this),_i(this.storedValue,"toJSON",ii)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==$n.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),Tn);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new Oi),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Mn,zn=1;function Un(e,t,r){var n=function(){var n=zn++,i=Mn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ri(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Mn;Mn=e;try{return function(e,t,r){var n=new Bn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Mn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:Pi(arguments),context:e,tree:On(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var Bn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Hn(e){return"function"==typeof e?"":ei(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=ei(t)?"value of type "+ri(t).type.name+":":gi(t)?"value":"snapshot",o=r&&ei(t)&&r.is(ri(t).snapshot);return""+i+a+" "+Hn(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return kn(e)&&(e.flags&(An.String|An.Number|An.Integer|An.Boolean|An.Date))>0}(r)||gi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Gn(e,t,r){return e.concat([{path:t,type:r}])}function Kn(){return si}function Wn(e,t,r){return[{context:e,value:t,message:r}]}function qn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Yn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw fi(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Hn(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Fn).join("\n ")}(e,t,r))}(e,t)}var $n,Jn=0,Xn=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Jn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],ci));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw fi("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw fi("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Zn(e,t,r,n,i){var a=ni(i);if(a){if(a.parent)throw fi("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new In(e,t,r,n,i)}function Qn(e,t,r,n,i){return new jn(e,t,r,n,i)}function ei(e){return!(!e||!e.$treenode)}function ti(e,t){Si()}function ri(e){if(!ei(e))throw fi("Value "+e+" is no MST Node");return e.$treenode}function ni(e){return e&&e.$treenode||null}function ii(){return ri(this).snapshot}function ai(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=ei(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,ei(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Di?Wn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=kn(e)?this._subtype:ei(e)?wn(e,!1):this.preProcessSnapshotSafe(e);return t!==Di&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof xn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Vn),Ri="Map.put can only be used to store complex values that have an identifier type attribute";function Li(e,t){var r,n,i=e.getSubTypes();if(i===Nn)return!1;if(i){var a=di(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Li(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Yi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(xi||(xi={}));var Mi=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw fi("Map.put cannot be used to set empty values");if(ei(e)){var t=ri(e);if(null===t.identifier)throw fi(Ri);return this.set(t.identifier,e),e}if(yi(e)){var r=ri(this),n=r.type;if(n.identifierMode!==xi.YES)throw fi(Ri);var i=e[n.mapIdentifierAttribute];if(!xa(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(wn(a))}var o=Va(i);return this.set(o,e),this.get(o)}throw fi("Map.put can only be used to store complex values")}}),t}(Nr),zi=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:xi.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Zn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===xi.UNKNOWN){var e=[];if(Li(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw fi("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=xi.YES,this.mapIdentifierAttribute=t):this.identifierMode=xi.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Mi(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Un(t,e,n);_i(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw fi("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ri(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Yn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Yn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===xi.YES&&t instanceof In){var r=t.identifier;if(r!==e)throw fi("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ri(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ii(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ii(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ii(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Yn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return vi(e)?qn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Gn(t,n,r._subType))}))):Wn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return li}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(xn);zi.prototype.applySnapshot=Tt(zi.prototype.applySnapshot);var Ui=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Zn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},ci),{name:this.name});return Ae.array(oi(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Un(t,e,n);_i(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=ei(e)?ri(e).snapshot:e;return this._predicate(n)?Kn():Wn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn),la=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=An.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw fi("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw fi("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Yn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Kn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn);function pa(e,t,r){return function(e,t){if("function"!=typeof t&&ei(t))throw fi("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Rn()}(0,t),new fa(e,t,r||ba)}var ba=[void 0],ha=pa(na,void 0),da=pa(ra,null);function va(e){return Rn(),ca(e,ha)}var ya=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|An.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw fi("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Kn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Nn}}),t}(Vn),ga=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Qn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):mi(e)?Kn():Wn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(Dn),ma=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Qn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return mi(e)?this.subType?this.subType.validate(e,t):Kn():Wn(t,e,"Value is not serializable and cannot be frozen")}}),t}(Dn),_a=new ma,wa=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),xa(e))this.identifier=e;else{if(!ei(e))throw fi("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ri(e);if(!r.identifierAttribute)throw fi("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw fi("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Va(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new Oa("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),Oa=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),Pa=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return xa(e)?Kn():Wn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;kn(e=i.type)&&(e.flags&An.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ri(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Va(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===$n.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(Dn),ja=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=ei(n)?(ti(i=n),ri(i).identifier):n,o=new wa(n,this.targetType),u=Qn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=ei(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(Pa),Sa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=ei(n)?this.options.set(n,e?e.storedValue:null):n,a=Qn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=ei(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(Pa);function Aa(e,t){Rn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Sa(e,{get:r.get,set:r.set},n):new ja(e,n)}var Ea=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Yi))throw fi("Identifier types can only be instantiated as direct child of a model type");return Qn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw fi("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Wn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Kn()}}),t}(Dn),Ta=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(Ea),Ia=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(Ea),Na=new Ta,Ca=new Ia;function Va(e){return""+e}function xa(e){return"string"==typeof e||"number"==typeof e}var Da=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Kn();var r=this.options.getValidationMessage(e);return r?Wn(t,e,"Invalid value for type '"+this.name+"': "+r):Kn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Qn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(Dn),ka={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ca.apply(void 0,yn(r.map((function(e){return ua(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Rn(),new Ui(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?_a:kn(e)?new ma(e):pa(_a,e)},identifier:Na,identifierNumber:Ca,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ya(r,"string"==typeof e?t:e)},lazy:function(e,t){return new ga(e,t)},undefined:na,null:ra,snapshotProcessor:function(e,t,r){return Rn(),new ki(e,t,r)}};const Ra=require("benchmark");var La=new(e.n(Ra)().Suite);const Ma={};La.on("complete",(function(){const e=La.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ma[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),La.add("Create 1 model and set a integer value with applyAction",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=ka.model({string:ka.string,number:ka.number,integer:ka.integer,float:ka.float,boolean:ka.boolean,date:ka.Date}).actions((e=>({setString(t){e.string=t},setNumber(t){e.number=t},setInteger(t){e.integer=t},setFloat(t){e.float=t},setBoolean(t){e.boolean=t},setDate(t){e.date=t}})));var r,n;Ln(t.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}),{name:"setInteger",path:"",args:[2]}),r="Create 1 model and set a integer value with applyAction",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ma[r]?Ma[r]=Math.max(Ma[r],n):Ma[r]=n})),La.on("cycle",(function(e){console.log(String(e.target))})),La.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/create-1-model-and-set-a-integer-value-with-applyaction-node-bundle.js.LICENSE.txt b/build/create-1-model-and-set-a-integer-value-with-applyaction-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/create-1-model-and-set-a-integer-value-with-applyaction-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/create-1-model-and-set-a-integer-value-with-applyaction-web-bundle.js b/build/create-1-model-and-set-a-integer-value-with-applyaction-web-bundle.js new file mode 100644 index 0000000..f6cd2a9 --- /dev/null +++ b/build/create-1-model-and-set-a-integer-value-with-applyaction-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-1-model-and-set-a-integer-value-with-applyaction-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,P=a.floor,j=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:j(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=j(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,P=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,P.elapsed=(m-P.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,P.cycle=f*e.count,P.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",P="[object Number]",j="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Pe="\\u2700-\\u27bf",je="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+Pe+"]",Ne="["+je+"]",Ve="[^"+we+xe+Ie+Pe+je+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[P]=it[j]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[P]=ot[j]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function Pt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function jt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,Pe=t.Math,je=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=je.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(je),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(je.getPrototypeOf,je),He=je.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(je,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=Pe.ceil,ht=Pe.floor,dt=je.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(je.keys,je),vn=Pe.max,yn=Pe.min,gn=ie.now,_n=t.parseInt,mn=Pe.random,wn=Ee.reverse,On=lo(t,"DataView"),Pn=lo(t,"Map"),jn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(je,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(Pn),kn=Mo(jn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==j||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case P:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?je(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=je(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(Pn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!Pn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in je(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(jo(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Pi(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=je(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return Pt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?Pt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var Pa=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),ja=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&Pr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&Pr(e)==g};function Xa(e){if(!eu(e))return!1;var t=Pr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=Pr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&Pr(e)==P}function ru(e){if(!eu(e)||Pr(e)!=j)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&Pr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&Pr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&Pr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[Pr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),Pu=Kr((function(e,t){e=je(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return Pt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),Pl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),Pt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==Pr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,jr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),jr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:Pt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,Pt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(jt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,Pn,jn=P("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&jn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,Pn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):j(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(j(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Pn,get:function(){return"Map"}}]),t}(),kn=P("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():j(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Xr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Pr);jr.prototype.die=Et(jr.prototype.die);var Sr,Ar,xr=1,Er={onError:function(e){throw e}},Tr=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++xr}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Zr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw fi("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=No(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Xr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=si,this.state=Xr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Xr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw fi(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&Ti(e.subpath)||"",r=e.actionContext||Lr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(ti(i=r.context,1),ni(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(si),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ai(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw fi("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw fi("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Br(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=ki(t.path);oi(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Br(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),mi(this.storedValue,"$treenode",this),mi(this.storedValue,"toJSON",ii)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Xr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),Er);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new Oi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Lr,zr=1;function Br(e,t,n){var r=function(){var r=zr++,i=Lr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ni(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Lr;Lr=e;try{return function(e,t,n){var r=new Fr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Lr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:Pi(arguments),context:e,tree:Or(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var Fr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Ur(e){return"function"==typeof e?"":ei(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Wr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=ei(t)?"value of type "+ni(t).type.name+":":gi(t)?"value":"snapshot",a=n&&ei(t)&&n.is(ni(t).snapshot);return""+i+o+" "+Ur(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Dr(e)&&(e.flags&(Ar.String|Ar.Number|Ar.Integer|Ar.Boolean|Ar.Date))>0}(n)||gi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function $r(e,t,n){return e.concat([{path:t,type:n}])}function Hr(){return li}function Gr(e,t,n){return[{context:e,value:t,message:n}]}function Kr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function qr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw fi(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Ur(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Wr).join("\n ")}(e,t,n))}(e,t)}var Xr,Yr=0,Zr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],ci));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw fi("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw fi("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Jr(e,t,n,r,i){var o=ri(i);if(o){if(o.parent)throw fi("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Tr(e,t,n,r,i)}function Qr(e,t,n,r,i){return new jr(e,t,n,r,i)}function ei(e){return!(!e||!e.$treenode)}function ti(e,t){Si()}function ni(e){if(!ei(e))throw fi("Value "+e+" is no MST Node");return e.$treenode}function ri(e){return e&&e.$treenode||null}function ii(){return ni(this).snapshot}function oi(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=ei(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,ei(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Vi?Gr(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dr(e)?this._subtype:ei(e)?wr(e,!1):this.preProcessSnapshotSafe(e);return t!==Vi&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Nr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(kr),Ri="Map.put can only be used to store complex values that have an identifier type attribute";function Mi(e,t){var n,r,i=e.getSubTypes();if(i===Cr)return!1;if(i){var o=di(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Mi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof qi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var Li=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw fi("Map.put cannot be used to set empty values");if(ei(e)){var t=ni(e);if(null===t.identifier)throw fi(Ri);return this.set(t.identifier,e),e}if(yi(e)){var n=ni(this),r=n.type;if(r.identifierMode!==Ni.YES)throw fi(Ri);var i=e[r.mapIdentifierAttribute];if(!Vo(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(wr(o))}var a=No(i);return this.set(a,e),this.get(a)}throw fi("Map.put can only be used to store complex values")}}),t}(In),zi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Jr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Mi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw fi("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Li(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Br(t,e,r);mi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw fi("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ni(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;qr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":qr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tr){var n=t.identifier;if(n!==e)throw fi("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ni(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ti(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ti(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ti(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){qr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return vi(e)?Kr(Object.keys(e).map((function(r){return n._subType.validate(e[r],$r(t,r,n._subType))}))):Gr(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return si}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Nr);zi.prototype.applySnapshot=Et(zi.prototype.applySnapshot);var Bi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Jr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},ci),{name:this.name});return Ae.array(ai(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Br(t,e,r);mi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=ei(e)?ni(e).snapshot:e;return this._predicate(r)?Hr():Gr(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(kr),so=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Ar.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw fi("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw fi("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&qr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(kr);function po(e,t,n){return function(e,t){if("function"!=typeof t&&ei(t))throw fi("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Rr()}(0,t),new fo(e,t,n||ho)}var ho=[void 0],bo=po(ro,void 0),vo=po(no,null);function yo(e){return Rr(),co(e,bo)}var go=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Ar.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw fi("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Hr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Cr}}),t}(kr),_o=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Qr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):_i(e)?Hr():Gr(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Vr),mo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Qr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return _i(e)?this.subType?this.subType.validate(e,t):Hr():Gr(t,e,"Value is not serializable and cannot be frozen")}}),t}(Vr),wo=new mo,Oo=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Vo(e))this.identifier=e;else{if(!ei(e))throw fi("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ni(e);if(!n.identifierAttribute)throw fi("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw fi("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=No(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new Po("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),Po=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),jo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Vo(e)?Hr():Gr(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dr(e=i.type)&&(e.flags&Ar.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ni(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,No(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Xr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Vr),So=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=ei(r)?(ti(i=r),ni(i).identifier):r,a=new Oo(r,this.targetType),u=Qr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=ei(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(jo),Ao=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=ei(r)?this.options.set(r,e?e.storedValue:null):r,o=Qr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=ei(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(jo);function xo(e,t){Rr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new Ao(e,{get:n.get,set:n.set},r):new So(e,r)}var Eo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof qi))throw fi("Identifier types can only be instantiated as direct child of a model type");return Qr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw fi("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gr(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hr()}}),t}(Vr),To=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(Eo),Co=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(Eo),Io=new To,ko=new Co;function No(e){return""+e}function Vo(e){return"string"==typeof e||"number"==typeof e}var Do=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hr();var n=this.options.getValidationMessage(e);return n?Gr(t,e,"Invalid value for type '"+this.name+"': "+n):Hr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Qr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Vr),Ro={enumeration:function(e,t){var n="string"==typeof e?t:e,r=co.apply(void 0,yr(n.map((function(e){return uo(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Rr(),new Bi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?wo:Dr(e)?new mo(e):po(wo,e)},identifier:Io,identifierNumber:ko,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new go(n,"string"==typeof e?t:e)},lazy:function(e,t){return new _o(e,t)},undefined:ro,null:no,snapshotProcessor:function(e,t,n){return Rr(),new Di(e,t,n)}},Mo=n(215),Lo=new(n.n(Mo)().Suite);const zo={};Lo.on("complete",(function(){const e=Lo.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:zo[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Lo.add("Create 1 model and set a integer value with applyAction",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=Ro.model({string:Ro.string,number:Ro.number,integer:Ro.integer,float:Ro.float,boolean:Ro.boolean,date:Ro.Date}).actions((e=>({setString(t){e.string=t},setNumber(t){e.number=t},setInteger(t){e.integer=t},setFloat(t){e.float=t},setBoolean(t){e.boolean=t},setDate(t){e.date=t}})));var n,r;Mr(t.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}),{name:"setInteger",path:"",args:[2]}),n="Create 1 model and set a integer value with applyAction",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,zo[n]?zo[n]=Math.max(zo[n],r):zo[n]=r})),Lo.on("cycle",(function(e){console.log(String(e.target))})),Lo.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/create-1-model-and-set-a-integer-value-with-applyaction-web-bundle.js.LICENSE.txt b/build/create-1-model-and-set-a-integer-value-with-applyaction-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/create-1-model-and-set-a-integer-value-with-applyaction-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/create-1-model-and-set-a-number-value-bundle-source.js b/build/create-1-model-and-set-a-number-value-bundle-source.js new file mode 100644 index 0000000..4eef0d6 --- /dev/null +++ b/build/create-1-model-and-set-a-number-value-bundle-source.js @@ -0,0 +1,122 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Create 1 model and set a number value", () => { + const startMemory = getStartMemory(); + const ModelWithPrimitivesAndActions = types + .model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, + }) + .actions((self) => ({ + setString(string) { + self.string = string; + }, + setNumber(number) { + self.number = number; + }, + setInteger(integer) { + self.integer = integer; + }, + setFloat(float) { + self.float = float; + }, + setBoolean(boolean) { + self.boolean = boolean; + }, + setDate(date) { + self.date = date; + }, + })); + +ModelWithPrimitivesAndActions.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), +}).setNumber(2); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Create 1 model and set a number value", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/create-1-model-and-set-a-number-value-node-bundle.js b/build/create-1-model-and-set-a-number-value-node-bundle.js new file mode 100644 index 0000000..02420ef --- /dev/null +++ b/build/create-1-model-and-set-a-number-value-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-1-model-and-set-a-number-value-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Ci?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Ci&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Ca=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Va={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Vi(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Create 1 model and set a number value",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=Va.model({string:Va.string,number:Va.number,integer:Va.integer,float:Va.float,boolean:Va.boolean,date:Va.Date}).actions((e=>({setString(t){e.string=t},setNumber(t){e.number=t},setInteger(t){e.integer=t},setFloat(t){e.float=t},setBoolean(t){e.boolean=t},setDate(t){e.date=t}})));var r,n;t.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}).setNumber(2),r="Create 1 model and set a number value",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[r]?ka[r]=Math.max(ka[r],n):ka[r]=n})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/create-1-model-and-set-a-number-value-node-bundle.js.LICENSE.txt b/build/create-1-model-and-set-a-number-value-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/create-1-model-and-set-a-number-value-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/create-1-model-and-set-a-number-value-web-bundle.js b/build/create-1-model-and-set-a-number-value-web-bundle.js new file mode 100644 index 0000000..df2c2c0 --- /dev/null +++ b/build/create-1-model-and-set-a-number-value-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-1-model-and-set-a-number-value-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw si("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw si(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw si("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw si("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw si("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw si(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw si("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw si("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw si("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw si("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw si("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw si(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw si(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw si("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw si("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw si("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw si("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw si("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw si("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function so(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw si("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||co)}var co=[void 0],fo=so(eo,void 0),po=so(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw si("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw si("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw si("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw si("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw si("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw si("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):so(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Create 1 model and set a number value",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=No.model({string:No.string,number:No.number,integer:No.integer,float:No.float,boolean:No.boolean,date:No.Date}).actions((e=>({setString(t){e.string=t},setNumber(t){e.number=t},setInteger(t){e.integer=t},setFloat(t){e.float=t},setBoolean(t){e.boolean=t},setDate(t){e.date=t}})));var n,r;t.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}).setNumber(2),n="Create 1 model and set a number value",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[n]?Ro[n]=Math.max(Ro[n],r):Ro[n]=r})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/create-1-model-and-set-a-number-value-web-bundle.js.LICENSE.txt b/build/create-1-model-and-set-a-number-value-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/create-1-model-and-set-a-number-value-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/create-1-model-and-set-a-number-value-with-applyaction-bundle-source.js b/build/create-1-model-and-set-a-number-value-with-applyaction-bundle-source.js new file mode 100644 index 0000000..789511d --- /dev/null +++ b/build/create-1-model-and-set-a-number-value-with-applyaction-bundle-source.js @@ -0,0 +1,128 @@ + +import { applyAction, types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Create 1 model and set a number value with applyAction", () => { + const startMemory = getStartMemory(); + const ModelWithPrimitivesAndActions = types + .model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, + }) + .actions((self) => ({ + setString(string) { + self.string = string; + }, + setNumber(number) { + self.number = number; + }, + setInteger(integer) { + self.integer = integer; + }, + setFloat(float) { + self.float = float; + }, + setBoolean(boolean) { + self.boolean = boolean; + }, + setDate(date) { + self.date = date; + }, + })); + +const m = ModelWithPrimitivesAndActions.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), +}); + +applyAction(m, { + name: "setNumber", + path: "", + args: [1], +}); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Create 1 model and set a number value with applyAction", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/create-1-model-and-set-a-number-value-with-applyaction-node-bundle.js b/build/create-1-model-and-set-a-number-value-with-applyaction-node-bundle.js new file mode 100644 index 0000000..e6b8bb4 --- /dev/null +++ b/build/create-1-model-and-set-a-number-value-with-applyaction-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-1-model-and-set-a-number-value-with-applyaction-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var H=Symbol("mobx administration"),F=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[H]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ht=ee("flow.bound",{bound:!0}),Ft=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||Fe(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[H].values_.has(t):Br(e)||!!e[H]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[H].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[H].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[H].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[H].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[H]}Ft.bound=U(Ht);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[H];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[H];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[H];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[H])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[H]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new He(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new He(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[H]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:H});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==$n.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Pn);jn.prototype.die=Tt(jn.prototype.die);var Sn,An,En=1,Tn={onError:function(e){throw e}},In=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++En}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new Xn),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw fi("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Va(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=$n.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=li,this.state=$n.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=$n.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw fi(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ii(e.subpath)||"",n=e.actionContext||Mn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(ti(i=n.context,1),ri(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(li),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):oi(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw fi("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw fi("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Un(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=Vi(t.path);ai(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Un(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),_i(this.storedValue,"$treenode",this),_i(this.storedValue,"toJSON",ii)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==$n.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),Tn);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new Oi),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Mn,zn=1;function Un(e,t,r){var n=function(){var n=zn++,i=Mn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ri(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Mn;Mn=e;try{return function(e,t,r){var n=new Bn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Mn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:Pi(arguments),context:e,tree:On(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var Bn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Hn(e){return"function"==typeof e?"":ei(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=ei(t)?"value of type "+ri(t).type.name+":":gi(t)?"value":"snapshot",o=r&&ei(t)&&r.is(ri(t).snapshot);return""+i+a+" "+Hn(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return kn(e)&&(e.flags&(An.String|An.Number|An.Integer|An.Boolean|An.Date))>0}(r)||gi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Gn(e,t,r){return e.concat([{path:t,type:r}])}function Kn(){return si}function Wn(e,t,r){return[{context:e,value:t,message:r}]}function qn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Yn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw fi(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Hn(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Fn).join("\n ")}(e,t,r))}(e,t)}var $n,Jn=0,Xn=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Jn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],ci));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw fi("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw fi("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Zn(e,t,r,n,i){var a=ni(i);if(a){if(a.parent)throw fi("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new In(e,t,r,n,i)}function Qn(e,t,r,n,i){return new jn(e,t,r,n,i)}function ei(e){return!(!e||!e.$treenode)}function ti(e,t){Si()}function ri(e){if(!ei(e))throw fi("Value "+e+" is no MST Node");return e.$treenode}function ni(e){return e&&e.$treenode||null}function ii(){return ri(this).snapshot}function ai(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=ei(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,ei(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Di?Wn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=kn(e)?this._subtype:ei(e)?wn(e,!1):this.preProcessSnapshotSafe(e);return t!==Di&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof xn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Vn),Ri="Map.put can only be used to store complex values that have an identifier type attribute";function Li(e,t){var r,n,i=e.getSubTypes();if(i===Nn)return!1;if(i){var a=di(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Li(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Yi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(xi||(xi={}));var Mi=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw fi("Map.put cannot be used to set empty values");if(ei(e)){var t=ri(e);if(null===t.identifier)throw fi(Ri);return this.set(t.identifier,e),e}if(yi(e)){var r=ri(this),n=r.type;if(n.identifierMode!==xi.YES)throw fi(Ri);var i=e[n.mapIdentifierAttribute];if(!xa(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(wn(a))}var o=Va(i);return this.set(o,e),this.get(o)}throw fi("Map.put can only be used to store complex values")}}),t}(Nr),zi=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:xi.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Zn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===xi.UNKNOWN){var e=[];if(Li(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw fi("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=xi.YES,this.mapIdentifierAttribute=t):this.identifierMode=xi.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Mi(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Un(t,e,n);_i(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw fi("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ri(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Yn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Yn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===xi.YES&&t instanceof In){var r=t.identifier;if(r!==e)throw fi("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ri(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ii(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ii(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ii(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Yn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return vi(e)?qn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Gn(t,n,r._subType))}))):Wn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return li}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(xn);zi.prototype.applySnapshot=Tt(zi.prototype.applySnapshot);var Ui=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Zn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},ci),{name:this.name});return Ae.array(oi(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Un(t,e,n);_i(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=ei(e)?ri(e).snapshot:e;return this._predicate(n)?Kn():Wn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn),la=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=An.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw fi("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw fi("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Yn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Kn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn);function pa(e,t,r){return function(e,t){if("function"!=typeof t&&ei(t))throw fi("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Rn()}(0,t),new fa(e,t,r||ba)}var ba=[void 0],ha=pa(na,void 0),da=pa(ra,null);function va(e){return Rn(),ca(e,ha)}var ya=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|An.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw fi("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Kn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Nn}}),t}(Vn),ga=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Qn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):mi(e)?Kn():Wn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(Dn),ma=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Qn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return mi(e)?this.subType?this.subType.validate(e,t):Kn():Wn(t,e,"Value is not serializable and cannot be frozen")}}),t}(Dn),_a=new ma,wa=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),xa(e))this.identifier=e;else{if(!ei(e))throw fi("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ri(e);if(!r.identifierAttribute)throw fi("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw fi("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Va(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new Oa("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),Oa=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),Pa=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return xa(e)?Kn():Wn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;kn(e=i.type)&&(e.flags&An.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ri(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Va(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===$n.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(Dn),ja=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=ei(n)?(ti(i=n),ri(i).identifier):n,o=new wa(n,this.targetType),u=Qn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=ei(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(Pa),Sa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=ei(n)?this.options.set(n,e?e.storedValue:null):n,a=Qn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=ei(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(Pa);function Aa(e,t){Rn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Sa(e,{get:r.get,set:r.set},n):new ja(e,n)}var Ea=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Yi))throw fi("Identifier types can only be instantiated as direct child of a model type");return Qn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw fi("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Wn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Kn()}}),t}(Dn),Ta=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(Ea),Ia=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(Ea),Na=new Ta,Ca=new Ia;function Va(e){return""+e}function xa(e){return"string"==typeof e||"number"==typeof e}var Da=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Kn();var r=this.options.getValidationMessage(e);return r?Wn(t,e,"Invalid value for type '"+this.name+"': "+r):Kn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Qn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(Dn),ka={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ca.apply(void 0,yn(r.map((function(e){return ua(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Rn(),new Ui(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?_a:kn(e)?new ma(e):pa(_a,e)},identifier:Na,identifierNumber:Ca,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ya(r,"string"==typeof e?t:e)},lazy:function(e,t){return new ga(e,t)},undefined:na,null:ra,snapshotProcessor:function(e,t,r){return Rn(),new ki(e,t,r)}};const Ra=require("benchmark");var La=new(e.n(Ra)().Suite);const Ma={};La.on("complete",(function(){const e=La.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ma[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),La.add("Create 1 model and set a number value with applyAction",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=ka.model({string:ka.string,number:ka.number,integer:ka.integer,float:ka.float,boolean:ka.boolean,date:ka.Date}).actions((e=>({setString(t){e.string=t},setNumber(t){e.number=t},setInteger(t){e.integer=t},setFloat(t){e.float=t},setBoolean(t){e.boolean=t},setDate(t){e.date=t}})));var r,n;Ln(t.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}),{name:"setNumber",path:"",args:[1]}),r="Create 1 model and set a number value with applyAction",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ma[r]?Ma[r]=Math.max(Ma[r],n):Ma[r]=n})),La.on("cycle",(function(e){console.log(String(e.target))})),La.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/create-1-model-and-set-a-number-value-with-applyaction-node-bundle.js.LICENSE.txt b/build/create-1-model-and-set-a-number-value-with-applyaction-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/create-1-model-and-set-a-number-value-with-applyaction-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/create-1-model-and-set-a-number-value-with-applyaction-web-bundle.js b/build/create-1-model-and-set-a-number-value-with-applyaction-web-bundle.js new file mode 100644 index 0000000..5077a66 --- /dev/null +++ b/build/create-1-model-and-set-a-number-value-with-applyaction-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-1-model-and-set-a-number-value-with-applyaction-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,P=a.floor,j=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:j(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=j(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,P=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,P.elapsed=(m-P.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,P.cycle=f*e.count,P.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",P="[object Number]",j="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Pe="\\u2700-\\u27bf",je="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+Pe+"]",Ne="["+je+"]",Ve="[^"+we+xe+Ie+Pe+je+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[P]=it[j]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[P]=ot[j]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function Pt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function jt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,Pe=t.Math,je=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=je.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(je),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(je.getPrototypeOf,je),He=je.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(je,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=Pe.ceil,ht=Pe.floor,dt=je.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(je.keys,je),vn=Pe.max,yn=Pe.min,gn=ie.now,_n=t.parseInt,mn=Pe.random,wn=Ee.reverse,On=lo(t,"DataView"),Pn=lo(t,"Map"),jn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(je,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(Pn),kn=Mo(jn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==j||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case P:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?je(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=je(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(Pn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!Pn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in je(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(jo(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Pi(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=je(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return Pt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?Pt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var Pa=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),ja=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&Pr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&Pr(e)==g};function Xa(e){if(!eu(e))return!1;var t=Pr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=Pr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&Pr(e)==P}function ru(e){if(!eu(e)||Pr(e)!=j)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&Pr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&Pr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&Pr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[Pr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),Pu=Kr((function(e,t){e=je(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return Pt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),Pl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),Pt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==Pr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,jr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),jr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:Pt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,Pt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(jt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,Pn,jn=P("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&jn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,Pn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):j(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(j(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Pn,get:function(){return"Map"}}]),t}(),kn=P("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():j(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Xr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Pr);jr.prototype.die=Et(jr.prototype.die);var Sr,Ar,xr=1,Er={onError:function(e){throw e}},Tr=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++xr}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Zr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw fi("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=No(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Xr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=si,this.state=Xr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Xr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw fi(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&Ti(e.subpath)||"",r=e.actionContext||Lr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(ti(i=r.context,1),ni(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(si),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ai(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw fi("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw fi("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Br(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=ki(t.path);oi(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Br(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),mi(this.storedValue,"$treenode",this),mi(this.storedValue,"toJSON",ii)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Xr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),Er);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new Oi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Lr,zr=1;function Br(e,t,n){var r=function(){var r=zr++,i=Lr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ni(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Lr;Lr=e;try{return function(e,t,n){var r=new Fr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Lr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:Pi(arguments),context:e,tree:Or(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var Fr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Ur(e){return"function"==typeof e?"":ei(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Wr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=ei(t)?"value of type "+ni(t).type.name+":":gi(t)?"value":"snapshot",a=n&&ei(t)&&n.is(ni(t).snapshot);return""+i+o+" "+Ur(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Dr(e)&&(e.flags&(Ar.String|Ar.Number|Ar.Integer|Ar.Boolean|Ar.Date))>0}(n)||gi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function $r(e,t,n){return e.concat([{path:t,type:n}])}function Hr(){return li}function Gr(e,t,n){return[{context:e,value:t,message:n}]}function Kr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function qr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw fi(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Ur(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Wr).join("\n ")}(e,t,n))}(e,t)}var Xr,Yr=0,Zr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],ci));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw fi("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw fi("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Jr(e,t,n,r,i){var o=ri(i);if(o){if(o.parent)throw fi("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Tr(e,t,n,r,i)}function Qr(e,t,n,r,i){return new jr(e,t,n,r,i)}function ei(e){return!(!e||!e.$treenode)}function ti(e,t){Si()}function ni(e){if(!ei(e))throw fi("Value "+e+" is no MST Node");return e.$treenode}function ri(e){return e&&e.$treenode||null}function ii(){return ni(this).snapshot}function oi(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=ei(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,ei(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Vi?Gr(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dr(e)?this._subtype:ei(e)?wr(e,!1):this.preProcessSnapshotSafe(e);return t!==Vi&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Nr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(kr),Ri="Map.put can only be used to store complex values that have an identifier type attribute";function Mi(e,t){var n,r,i=e.getSubTypes();if(i===Cr)return!1;if(i){var o=di(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Mi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof qi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var Li=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw fi("Map.put cannot be used to set empty values");if(ei(e)){var t=ni(e);if(null===t.identifier)throw fi(Ri);return this.set(t.identifier,e),e}if(yi(e)){var n=ni(this),r=n.type;if(r.identifierMode!==Ni.YES)throw fi(Ri);var i=e[r.mapIdentifierAttribute];if(!Vo(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(wr(o))}var a=No(i);return this.set(a,e),this.get(a)}throw fi("Map.put can only be used to store complex values")}}),t}(In),zi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Jr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Mi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw fi("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Li(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Br(t,e,r);mi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw fi("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ni(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;qr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":qr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tr){var n=t.identifier;if(n!==e)throw fi("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ni(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ti(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ti(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ti(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){qr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return vi(e)?Kr(Object.keys(e).map((function(r){return n._subType.validate(e[r],$r(t,r,n._subType))}))):Gr(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return si}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Nr);zi.prototype.applySnapshot=Et(zi.prototype.applySnapshot);var Bi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Jr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},ci),{name:this.name});return Ae.array(ai(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Br(t,e,r);mi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=ei(e)?ni(e).snapshot:e;return this._predicate(r)?Hr():Gr(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(kr),so=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Ar.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw fi("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw fi("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&qr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(kr);function po(e,t,n){return function(e,t){if("function"!=typeof t&&ei(t))throw fi("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Rr()}(0,t),new fo(e,t,n||ho)}var ho=[void 0],bo=po(ro,void 0),vo=po(no,null);function yo(e){return Rr(),co(e,bo)}var go=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Ar.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw fi("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Hr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Cr}}),t}(kr),_o=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Qr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):_i(e)?Hr():Gr(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Vr),mo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Qr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return _i(e)?this.subType?this.subType.validate(e,t):Hr():Gr(t,e,"Value is not serializable and cannot be frozen")}}),t}(Vr),wo=new mo,Oo=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Vo(e))this.identifier=e;else{if(!ei(e))throw fi("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ni(e);if(!n.identifierAttribute)throw fi("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw fi("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=No(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new Po("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),Po=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),jo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Vo(e)?Hr():Gr(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dr(e=i.type)&&(e.flags&Ar.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ni(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,No(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Xr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Vr),So=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=ei(r)?(ti(i=r),ni(i).identifier):r,a=new Oo(r,this.targetType),u=Qr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=ei(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(jo),Ao=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=ei(r)?this.options.set(r,e?e.storedValue:null):r,o=Qr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=ei(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(jo);function xo(e,t){Rr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new Ao(e,{get:n.get,set:n.set},r):new So(e,r)}var Eo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof qi))throw fi("Identifier types can only be instantiated as direct child of a model type");return Qr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw fi("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gr(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hr()}}),t}(Vr),To=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(Eo),Co=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(Eo),Io=new To,ko=new Co;function No(e){return""+e}function Vo(e){return"string"==typeof e||"number"==typeof e}var Do=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hr();var n=this.options.getValidationMessage(e);return n?Gr(t,e,"Invalid value for type '"+this.name+"': "+n):Hr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Qr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Vr),Ro={enumeration:function(e,t){var n="string"==typeof e?t:e,r=co.apply(void 0,yr(n.map((function(e){return uo(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Rr(),new Bi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?wo:Dr(e)?new mo(e):po(wo,e)},identifier:Io,identifierNumber:ko,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new go(n,"string"==typeof e?t:e)},lazy:function(e,t){return new _o(e,t)},undefined:ro,null:no,snapshotProcessor:function(e,t,n){return Rr(),new Di(e,t,n)}},Mo=n(215),Lo=new(n.n(Mo)().Suite);const zo={};Lo.on("complete",(function(){const e=Lo.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:zo[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Lo.add("Create 1 model and set a number value with applyAction",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=Ro.model({string:Ro.string,number:Ro.number,integer:Ro.integer,float:Ro.float,boolean:Ro.boolean,date:Ro.Date}).actions((e=>({setString(t){e.string=t},setNumber(t){e.number=t},setInteger(t){e.integer=t},setFloat(t){e.float=t},setBoolean(t){e.boolean=t},setDate(t){e.date=t}})));var n,r;Mr(t.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}),{name:"setNumber",path:"",args:[1]}),n="Create 1 model and set a number value with applyAction",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,zo[n]?zo[n]=Math.max(zo[n],r):zo[n]=r})),Lo.on("cycle",(function(e){console.log(String(e.target))})),Lo.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/create-1-model-and-set-a-number-value-with-applyaction-web-bundle.js.LICENSE.txt b/build/create-1-model-and-set-a-number-value-with-applyaction-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/create-1-model-and-set-a-number-value-with-applyaction-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/create-1-model-and-set-a-string-value-bundle-source.js b/build/create-1-model-and-set-a-string-value-bundle-source.js new file mode 100644 index 0000000..b36ebec --- /dev/null +++ b/build/create-1-model-and-set-a-string-value-bundle-source.js @@ -0,0 +1,122 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Create 1 model and set a string value", () => { + const startMemory = getStartMemory(); + const ModelWithPrimitivesAndActions = types + .model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, + }) + .actions((self) => ({ + setString(string) { + self.string = string; + }, + setNumber(number) { + self.number = number; + }, + setInteger(integer) { + self.integer = integer; + }, + setFloat(float) { + self.float = float; + }, + setBoolean(boolean) { + self.boolean = boolean; + }, + setDate(date) { + self.date = date; + }, + })); + +ModelWithPrimitivesAndActions.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), +}).setString("new string"); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Create 1 model and set a string value", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/create-1-model-and-set-a-string-value-node-bundle.js b/build/create-1-model-and-set-a-string-value-node-bundle.js new file mode 100644 index 0000000..7c5f283 --- /dev/null +++ b/build/create-1-model-and-set-a-string-value-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-1-model-and-set-a-string-value-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Ci?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Ci&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Ca=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Va={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Vi(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Create 1 model and set a string value",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=Va.model({string:Va.string,number:Va.number,integer:Va.integer,float:Va.float,boolean:Va.boolean,date:Va.Date}).actions((e=>({setString(t){e.string=t},setNumber(t){e.number=t},setInteger(t){e.integer=t},setFloat(t){e.float=t},setBoolean(t){e.boolean=t},setDate(t){e.date=t}})));var r,n;t.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}).setString("new string"),r="Create 1 model and set a string value",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[r]?ka[r]=Math.max(ka[r],n):ka[r]=n})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/create-1-model-and-set-a-string-value-node-bundle.js.LICENSE.txt b/build/create-1-model-and-set-a-string-value-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/create-1-model-and-set-a-string-value-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/create-1-model-and-set-a-string-value-web-bundle.js b/build/create-1-model-and-set-a-string-value-web-bundle.js new file mode 100644 index 0000000..eb346cf --- /dev/null +++ b/build/create-1-model-and-set-a-string-value-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-1-model-and-set-a-string-value-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,s=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),l=a.object&&e&&!e.nodeType&&e,c=s&&l&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(l&&l.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,l=e.Object,c=(e.RegExp,e.String),_=[],m=l.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,le(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=s&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,s={currentTarget:e},l={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),s.type="cycle",s.target=r,n=W(s),l.onCycle.call(e,n),n.aborted||!1===b())s.type="complete",l.onComplete.call(e,W(s));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function se(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function le(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,s=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+s+")"),fnArg:s,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}le=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,s=Z(u.fn),l=u.count=i.count,f=s||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||s);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=l)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=l}if(!v&&!a&&!y){v=o(u,f,a,d=(s||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=l,delete i.error}catch(e){u.count=l,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),le.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,s,l,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:le(t),l=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((s=W("error")).message=t.error,t.emit(s),s.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==l?1:-1:0):f<=(u<5||s<3?0:y[u][s-3])?f==l?1:-1:0},emit:oe,listeners:ae,off:ue,on:se,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,s=u.destination,l=s[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(l)||(r=!0,l=[]),l.length!=e.length&&(r=!0,(l=l.slice(0,e.length)).length=e.length)):t.isObjectLike(l)||(r=!0,l={}),r&&i.push({destination:s,key:n,value:l}),a.push({destination:l,source:e})):t.eq(l,e)||e===o||i.push({destination:s,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,s=[],l=e.stats.sample;function c(){s.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(s,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=l.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=l.length=s.length=0)),_||(f=q(l),y=t.reduce(l,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),s.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",s=32,l=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",l],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",s],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,se=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,le=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,st=parseInt,lt="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=lt||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&<.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=so(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,lt=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=so(t,"DataView"),jn=so(t,"Map"),Pn=so(t,"Promise"),Sn=so(t,"Set"),An=so(t,"WeakMap"),xn=so(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,s=1&t,l=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!s)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,s);if(p==P||p==d||h&&!o){if(u=l||h?{}:ho(e),!s)return l?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,lo(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,s)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?l?to:eo:l?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function sr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function lr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,s=[],l=t.length;if(!u)return s;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,s=u,l=r(u),c=1/0,f=[];s--;){var p=e[s];s&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),l[s]=!n&&(t||a>=120&&p.length>=120)?new Gn(s&&p):i}p=e[0];var h=-1,b=l[0];e:for(;++h=u?s:s*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,s,1),Ke.call(e,s,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):si(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,ns),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,s=e;null!=s&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var l=t?null:Gi(e);if(l)return sn(l);a=!1,i=Zt,s=new Gn}else s=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,s=null===t,l=t==t,c=uu(t);if(!s&&!c&&!a&&e>t||a&&u&&l&&!s&&!c||r&&u&&l||!n&&l||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!s&&"wrapper"==ro(u))var s=new Fn([],!0)}for(r=s?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof l&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?ts))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=lt||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,l,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=s}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=s}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,s,l,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,s=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);l=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return l=i,b&&r?d(e):(r=a=i,s)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(l===i)return function(e){return f=e,l=Eo(y,t),p?d(e):s}(c);if(h)return _i(l),l=Eo(y,t),d(c)}return l===i&&(l=Eo(y,t)),s}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){l!==i&&_i(l),f=0,r=c=a=l=i},_.flush=function(){return l===i?s:g(Sa())},_}var Ia=Kr((function(e,t){return sr(e,1,t)})),ka=Kr((function(e,t,n){return sr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||ds,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var su=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},lu=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?sn:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?st(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)si(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(se)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var es=Ri(),ts=Ri(!0);function ns(e){return e}function rs(e){return Nr("function"==typeof e?e:ar(e,1))}var is=Kr((function(e,t){return function(n){return Er(n,e,t)}})),os=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function as(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function us(){}var ss=Bi(It),ls=Bi(xt),cs=Bi(Dt);function fs(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var ps=Ui(),hs=Ui(!0);function bs(){return[]}function ds(){return!1}var vs,ys=zi((function(e,t){return e+t}),0),gs=Hi("ceil"),_s=zi((function(e,t){return e/t}),1),ms=Hi("floor"),ws=zi((function(e,t){return e*t}),1),Os=Hi("round"),js=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,s=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||su(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||si(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:li(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:li(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=sa,Ln.zip=la,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,as(Ln,Ln),Ln.add=ys,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gs,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_s,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ms,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=ns,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=su,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=lu,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,ns,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,ns)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,ns,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bs,Ln.stubFalse=ds,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=ws,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=us,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var s=n-cn(r);if(s<1)return r;var l=u?gi(u,0,s).join(""):e.slice(0,s);if(o===i)return l+r;if(u&&(s+=l.length-s),iu(o)){if(e.slice(s).search(o)){var c,f=l;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;l=l.slice(0,p===i?s:p)}}else if(e.indexOf(ai(o),s)!=s){var h=l.lastIndexOf(o);h>-1&&(l=l.slice(0,h))}return l+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,as(Ln,(vs={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vs[t]=e)})),vs),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(ns)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,s=t instanceof Un,l=u[0],c=s||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof l&&1!=l.length&&(s=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=s&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,s=a&&u&&"object"==typeof n.g&&n.g;!s||s.global!==s&&s.window!==s&&s.self!==s||(o=s);var l=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=l)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(l=n)?typeof l[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!l[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),s=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!s?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!s?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var s=t[o];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=n[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)lt(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,s=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var l=Vt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(s,l);e.then(c,n)}e=n,s(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function sn(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=l),an(this)){var o=sn(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return l;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=sn(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!sn(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=ln(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=ln(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=ln(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return lr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return lr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var s=r.value;if(!i.has(s))if(n.delete(s))a=!0;else{var l=n.data_.get(s);o.set(s,l)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!sn(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=ln(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!sn(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=ln(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return lr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=sr(e),t=sr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function sr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function lr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var s=a._childNodes[a.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw li(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var s,l,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(s=r.onError,l=n,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw li(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],si));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw li("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(r),s=!0)}s&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw li(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw li(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw li("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw li("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function lo(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new so(e,t,n||co)}var co=[void 0],fo=lo(eo,void 0),po=lo(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw li("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):lo(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Create 1 model and set a string value",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=No.model({string:No.string,number:No.number,integer:No.integer,float:No.float,boolean:No.boolean,date:No.Date}).actions((e=>({setString(t){e.string=t},setNumber(t){e.number=t},setInteger(t){e.integer=t},setFloat(t){e.float=t},setBoolean(t){e.boolean=t},setDate(t){e.date=t}})));var n,r;t.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}).setString("new string"),n="Create 1 model and set a string value",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[n]?Ro[n]=Math.max(Ro[n],r):Ro[n]=r})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/create-1-model-and-set-a-string-value-web-bundle.js.LICENSE.txt b/build/create-1-model-and-set-a-string-value-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/create-1-model-and-set-a-string-value-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/create-1-model-and-set-a-string-value-with-applyaction-bundle-source.js b/build/create-1-model-and-set-a-string-value-with-applyaction-bundle-source.js new file mode 100644 index 0000000..9189921 --- /dev/null +++ b/build/create-1-model-and-set-a-string-value-with-applyaction-bundle-source.js @@ -0,0 +1,128 @@ + +import { applyAction, types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Create 1 model and set a string value with applyAction", () => { + const startMemory = getStartMemory(); + const ModelWithPrimitivesAndActions = types + .model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, + }) + .actions((self) => ({ + setString(string) { + self.string = string; + }, + setNumber(number) { + self.number = number; + }, + setInteger(integer) { + self.integer = integer; + }, + setFloat(float) { + self.float = float; + }, + setBoolean(boolean) { + self.boolean = boolean; + }, + setDate(date) { + self.date = date; + }, + })); + +const m = ModelWithPrimitivesAndActions.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), +}); + +applyAction(m, { + name: "setString", + path: "", + args: ["new string"], +}); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Create 1 model and set a string value with applyAction", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/create-1-model-and-set-a-string-value-with-applyaction-node-bundle.js b/build/create-1-model-and-set-a-string-value-with-applyaction-node-bundle.js new file mode 100644 index 0000000..dfc71b0 --- /dev/null +++ b/build/create-1-model-and-set-a-string-value-with-applyaction-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-1-model-and-set-a-string-value-with-applyaction-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var H=Symbol("mobx administration"),F=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[H]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ht=ee("flow.bound",{bound:!0}),Ft=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||Fe(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[H].values_.has(t):Br(e)||!!e[H]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[H].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[H].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[H].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[H].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[H]}Ft.bound=U(Ht);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[H];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[H];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[H];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[H])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[H]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new He(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new He(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[H]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:H});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==$n.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Pn);jn.prototype.die=Tt(jn.prototype.die);var Sn,An,En=1,Tn={onError:function(e){throw e}},In=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++En}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new Xn),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw fi("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Va(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=$n.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=li,this.state=$n.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=$n.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw fi(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ii(e.subpath)||"",n=e.actionContext||Mn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(ti(i=n.context,1),ri(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(li),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):oi(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw fi("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw fi("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Un(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=Vi(t.path);ai(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Un(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),_i(this.storedValue,"$treenode",this),_i(this.storedValue,"toJSON",ii)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==$n.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),Tn);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new Oi),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Mn,zn=1;function Un(e,t,r){var n=function(){var n=zn++,i=Mn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ri(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Mn;Mn=e;try{return function(e,t,r){var n=new Bn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Mn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:Pi(arguments),context:e,tree:On(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var Bn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Hn(e){return"function"==typeof e?"":ei(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=ei(t)?"value of type "+ri(t).type.name+":":gi(t)?"value":"snapshot",o=r&&ei(t)&&r.is(ri(t).snapshot);return""+i+a+" "+Hn(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return kn(e)&&(e.flags&(An.String|An.Number|An.Integer|An.Boolean|An.Date))>0}(r)||gi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Gn(e,t,r){return e.concat([{path:t,type:r}])}function Kn(){return si}function Wn(e,t,r){return[{context:e,value:t,message:r}]}function qn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Yn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw fi(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Hn(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Fn).join("\n ")}(e,t,r))}(e,t)}var $n,Jn=0,Xn=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Jn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],ci));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw fi("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw fi("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Zn(e,t,r,n,i){var a=ni(i);if(a){if(a.parent)throw fi("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new In(e,t,r,n,i)}function Qn(e,t,r,n,i){return new jn(e,t,r,n,i)}function ei(e){return!(!e||!e.$treenode)}function ti(e,t){Si()}function ri(e){if(!ei(e))throw fi("Value "+e+" is no MST Node");return e.$treenode}function ni(e){return e&&e.$treenode||null}function ii(){return ri(this).snapshot}function ai(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=ei(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,ei(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Di?Wn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=kn(e)?this._subtype:ei(e)?wn(e,!1):this.preProcessSnapshotSafe(e);return t!==Di&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof xn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Vn),Ri="Map.put can only be used to store complex values that have an identifier type attribute";function Li(e,t){var r,n,i=e.getSubTypes();if(i===Nn)return!1;if(i){var a=di(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Li(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Yi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(xi||(xi={}));var Mi=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw fi("Map.put cannot be used to set empty values");if(ei(e)){var t=ri(e);if(null===t.identifier)throw fi(Ri);return this.set(t.identifier,e),e}if(yi(e)){var r=ri(this),n=r.type;if(n.identifierMode!==xi.YES)throw fi(Ri);var i=e[n.mapIdentifierAttribute];if(!xa(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(wn(a))}var o=Va(i);return this.set(o,e),this.get(o)}throw fi("Map.put can only be used to store complex values")}}),t}(Nr),zi=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:xi.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Zn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===xi.UNKNOWN){var e=[];if(Li(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw fi("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=xi.YES,this.mapIdentifierAttribute=t):this.identifierMode=xi.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Mi(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Un(t,e,n);_i(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw fi("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ri(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Yn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Yn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===xi.YES&&t instanceof In){var r=t.identifier;if(r!==e)throw fi("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ri(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ii(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ii(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ii(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Yn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return vi(e)?qn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Gn(t,n,r._subType))}))):Wn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return li}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(xn);zi.prototype.applySnapshot=Tt(zi.prototype.applySnapshot);var Ui=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Zn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},ci),{name:this.name});return Ae.array(oi(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Un(t,e,n);_i(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=ei(e)?ri(e).snapshot:e;return this._predicate(n)?Kn():Wn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn),la=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=An.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw fi("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw fi("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Yn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Kn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn);function pa(e,t,r){return function(e,t){if("function"!=typeof t&&ei(t))throw fi("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Rn()}(0,t),new fa(e,t,r||ba)}var ba=[void 0],ha=pa(na,void 0),da=pa(ra,null);function va(e){return Rn(),ca(e,ha)}var ya=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|An.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw fi("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Kn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Nn}}),t}(Vn),ga=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Qn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):mi(e)?Kn():Wn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(Dn),ma=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Qn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return mi(e)?this.subType?this.subType.validate(e,t):Kn():Wn(t,e,"Value is not serializable and cannot be frozen")}}),t}(Dn),_a=new ma,wa=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),xa(e))this.identifier=e;else{if(!ei(e))throw fi("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ri(e);if(!r.identifierAttribute)throw fi("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw fi("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Va(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new Oa("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),Oa=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),Pa=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return xa(e)?Kn():Wn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;kn(e=i.type)&&(e.flags&An.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ri(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Va(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===$n.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(Dn),ja=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=ei(n)?(ti(i=n),ri(i).identifier):n,o=new wa(n,this.targetType),u=Qn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=ei(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(Pa),Sa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=ei(n)?this.options.set(n,e?e.storedValue:null):n,a=Qn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=ei(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(Pa);function Aa(e,t){Rn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Sa(e,{get:r.get,set:r.set},n):new ja(e,n)}var Ea=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Yi))throw fi("Identifier types can only be instantiated as direct child of a model type");return Qn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw fi("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Wn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Kn()}}),t}(Dn),Ta=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(Ea),Ia=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(Ea),Na=new Ta,Ca=new Ia;function Va(e){return""+e}function xa(e){return"string"==typeof e||"number"==typeof e}var Da=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Kn();var r=this.options.getValidationMessage(e);return r?Wn(t,e,"Invalid value for type '"+this.name+"': "+r):Kn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Qn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(Dn),ka={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ca.apply(void 0,yn(r.map((function(e){return ua(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Rn(),new Ui(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?_a:kn(e)?new ma(e):pa(_a,e)},identifier:Na,identifierNumber:Ca,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ya(r,"string"==typeof e?t:e)},lazy:function(e,t){return new ga(e,t)},undefined:na,null:ra,snapshotProcessor:function(e,t,r){return Rn(),new ki(e,t,r)}};const Ra=require("benchmark");var La=new(e.n(Ra)().Suite);const Ma={};La.on("complete",(function(){const e=La.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ma[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),La.add("Create 1 model and set a string value with applyAction",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=ka.model({string:ka.string,number:ka.number,integer:ka.integer,float:ka.float,boolean:ka.boolean,date:ka.Date}).actions((e=>({setString(t){e.string=t},setNumber(t){e.number=t},setInteger(t){e.integer=t},setFloat(t){e.float=t},setBoolean(t){e.boolean=t},setDate(t){e.date=t}})));var r,n;Ln(t.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}),{name:"setString",path:"",args:["new string"]}),r="Create 1 model and set a string value with applyAction",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ma[r]?Ma[r]=Math.max(Ma[r],n):Ma[r]=n})),La.on("cycle",(function(e){console.log(String(e.target))})),La.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/create-1-model-and-set-a-string-value-with-applyaction-node-bundle.js.LICENSE.txt b/build/create-1-model-and-set-a-string-value-with-applyaction-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/create-1-model-and-set-a-string-value-with-applyaction-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/create-1-model-and-set-a-string-value-with-applyaction-web-bundle.js b/build/create-1-model-and-set-a-string-value-with-applyaction-web-bundle.js new file mode 100644 index 0000000..ea52b21 --- /dev/null +++ b/build/create-1-model-and-set-a-string-value-with-applyaction-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-1-model-and-set-a-string-value-with-applyaction-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,P=a.floor,j=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:j(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=j(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,P=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,P.elapsed=(m-P.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,P.cycle=f*e.count,P.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",P="[object Number]",j="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Pe="\\u2700-\\u27bf",je="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+Pe+"]",Ne="["+je+"]",Ve="[^"+we+xe+Ie+Pe+je+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[P]=it[j]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[P]=ot[j]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function Pt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function jt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,Pe=t.Math,je=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=je.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(je),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(je.getPrototypeOf,je),He=je.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(je,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=Pe.ceil,ht=Pe.floor,dt=je.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(je.keys,je),vn=Pe.max,yn=Pe.min,gn=ie.now,_n=t.parseInt,mn=Pe.random,wn=Ee.reverse,On=lo(t,"DataView"),Pn=lo(t,"Map"),jn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(je,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(Pn),kn=Mo(jn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==j||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case P:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?je(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=je(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(Pn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!Pn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in je(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(jo(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Pi(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=je(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return Pt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?Pt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var Pa=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),ja=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&Pr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&Pr(e)==g};function Xa(e){if(!eu(e))return!1;var t=Pr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=Pr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&Pr(e)==P}function ru(e){if(!eu(e)||Pr(e)!=j)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&Pr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&Pr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&Pr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[Pr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),Pu=Kr((function(e,t){e=je(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return Pt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),Pl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),Pt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==Pr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,jr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),jr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:Pt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,Pt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(jt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,Pn,jn=P("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&jn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,Pn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):j(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(j(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Pn,get:function(){return"Map"}}]),t}(),kn=P("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():j(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Xr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Pr);jr.prototype.die=Et(jr.prototype.die);var Sr,Ar,xr=1,Er={onError:function(e){throw e}},Tr=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++xr}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Zr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw fi("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=No(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Xr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=si,this.state=Xr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Xr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw fi(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&Ti(e.subpath)||"",r=e.actionContext||Lr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(ti(i=r.context,1),ni(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(si),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ai(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw fi("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw fi("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Br(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=ki(t.path);oi(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Br(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),mi(this.storedValue,"$treenode",this),mi(this.storedValue,"toJSON",ii)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Xr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),Er);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new Oi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Lr,zr=1;function Br(e,t,n){var r=function(){var r=zr++,i=Lr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ni(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Lr;Lr=e;try{return function(e,t,n){var r=new Fr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Lr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:Pi(arguments),context:e,tree:Or(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var Fr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Ur(e){return"function"==typeof e?"":ei(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Wr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=ei(t)?"value of type "+ni(t).type.name+":":gi(t)?"value":"snapshot",a=n&&ei(t)&&n.is(ni(t).snapshot);return""+i+o+" "+Ur(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Dr(e)&&(e.flags&(Ar.String|Ar.Number|Ar.Integer|Ar.Boolean|Ar.Date))>0}(n)||gi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function $r(e,t,n){return e.concat([{path:t,type:n}])}function Hr(){return li}function Gr(e,t,n){return[{context:e,value:t,message:n}]}function Kr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function qr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw fi(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Ur(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Wr).join("\n ")}(e,t,n))}(e,t)}var Xr,Yr=0,Zr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],ci));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw fi("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw fi("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Jr(e,t,n,r,i){var o=ri(i);if(o){if(o.parent)throw fi("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Tr(e,t,n,r,i)}function Qr(e,t,n,r,i){return new jr(e,t,n,r,i)}function ei(e){return!(!e||!e.$treenode)}function ti(e,t){Si()}function ni(e){if(!ei(e))throw fi("Value "+e+" is no MST Node");return e.$treenode}function ri(e){return e&&e.$treenode||null}function ii(){return ni(this).snapshot}function oi(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=ei(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,ei(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Vi?Gr(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dr(e)?this._subtype:ei(e)?wr(e,!1):this.preProcessSnapshotSafe(e);return t!==Vi&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Nr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(kr),Ri="Map.put can only be used to store complex values that have an identifier type attribute";function Mi(e,t){var n,r,i=e.getSubTypes();if(i===Cr)return!1;if(i){var o=di(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Mi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof qi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var Li=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw fi("Map.put cannot be used to set empty values");if(ei(e)){var t=ni(e);if(null===t.identifier)throw fi(Ri);return this.set(t.identifier,e),e}if(yi(e)){var n=ni(this),r=n.type;if(r.identifierMode!==Ni.YES)throw fi(Ri);var i=e[r.mapIdentifierAttribute];if(!Vo(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(wr(o))}var a=No(i);return this.set(a,e),this.get(a)}throw fi("Map.put can only be used to store complex values")}}),t}(In),zi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Jr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Mi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw fi("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Li(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Br(t,e,r);mi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw fi("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ni(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;qr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":qr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tr){var n=t.identifier;if(n!==e)throw fi("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ni(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ti(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ti(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ti(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){qr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return vi(e)?Kr(Object.keys(e).map((function(r){return n._subType.validate(e[r],$r(t,r,n._subType))}))):Gr(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return si}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Nr);zi.prototype.applySnapshot=Et(zi.prototype.applySnapshot);var Bi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Jr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},ci),{name:this.name});return Ae.array(ai(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Br(t,e,r);mi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=ei(e)?ni(e).snapshot:e;return this._predicate(r)?Hr():Gr(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(kr),so=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Ar.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw fi("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw fi("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&qr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(kr);function po(e,t,n){return function(e,t){if("function"!=typeof t&&ei(t))throw fi("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Rr()}(0,t),new fo(e,t,n||ho)}var ho=[void 0],bo=po(ro,void 0),vo=po(no,null);function yo(e){return Rr(),co(e,bo)}var go=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Ar.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw fi("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Hr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Cr}}),t}(kr),_o=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Qr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):_i(e)?Hr():Gr(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Vr),mo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Qr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return _i(e)?this.subType?this.subType.validate(e,t):Hr():Gr(t,e,"Value is not serializable and cannot be frozen")}}),t}(Vr),wo=new mo,Oo=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Vo(e))this.identifier=e;else{if(!ei(e))throw fi("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ni(e);if(!n.identifierAttribute)throw fi("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw fi("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=No(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new Po("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),Po=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),jo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Vo(e)?Hr():Gr(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dr(e=i.type)&&(e.flags&Ar.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ni(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,No(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Xr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Vr),So=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=ei(r)?(ti(i=r),ni(i).identifier):r,a=new Oo(r,this.targetType),u=Qr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=ei(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(jo),Ao=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=ei(r)?this.options.set(r,e?e.storedValue:null):r,o=Qr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=ei(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(jo);function xo(e,t){Rr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new Ao(e,{get:n.get,set:n.set},r):new So(e,r)}var Eo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof qi))throw fi("Identifier types can only be instantiated as direct child of a model type");return Qr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw fi("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gr(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hr()}}),t}(Vr),To=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(Eo),Co=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(Eo),Io=new To,ko=new Co;function No(e){return""+e}function Vo(e){return"string"==typeof e||"number"==typeof e}var Do=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hr();var n=this.options.getValidationMessage(e);return n?Gr(t,e,"Invalid value for type '"+this.name+"': "+n):Hr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Qr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Vr),Ro={enumeration:function(e,t){var n="string"==typeof e?t:e,r=co.apply(void 0,yr(n.map((function(e){return uo(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Rr(),new Bi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?wo:Dr(e)?new mo(e):po(wo,e)},identifier:Io,identifierNumber:ko,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new go(n,"string"==typeof e?t:e)},lazy:function(e,t){return new _o(e,t)},undefined:ro,null:no,snapshotProcessor:function(e,t,n){return Rr(),new Di(e,t,n)}},Mo=n(215),Lo=new(n.n(Mo)().Suite);const zo={};Lo.on("complete",(function(){const e=Lo.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:zo[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Lo.add("Create 1 model and set a string value with applyAction",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=Ro.model({string:Ro.string,number:Ro.number,integer:Ro.integer,float:Ro.float,boolean:Ro.boolean,date:Ro.Date}).actions((e=>({setString(t){e.string=t},setNumber(t){e.number=t},setInteger(t){e.integer=t},setFloat(t){e.float=t},setBoolean(t){e.boolean=t},setDate(t){e.date=t}})));var n,r;Mr(t.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}),{name:"setString",path:"",args:["new string"]}),n="Create 1 model and set a string value with applyAction",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,zo[n]?zo[n]=Math.max(zo[n],r):zo[n]=r})),Lo.on("cycle",(function(e){console.log(String(e.target))})),Lo.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/create-1-model-and-set-a-string-value-with-applyaction-web-bundle.js.LICENSE.txt b/build/create-1-model-and-set-a-string-value-with-applyaction-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/create-1-model-and-set-a-string-value-with-applyaction-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/create-1-model-and-set-an-integer-value-bundle-source.js b/build/create-1-model-and-set-an-integer-value-bundle-source.js new file mode 100644 index 0000000..f9fbf83 --- /dev/null +++ b/build/create-1-model-and-set-an-integer-value-bundle-source.js @@ -0,0 +1,122 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Create 1 model and set an integer value", () => { + const startMemory = getStartMemory(); + const ModelWithPrimitivesAndActions = types + .model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, + }) + .actions((self) => ({ + setString(string) { + self.string = string; + }, + setNumber(number) { + self.number = number; + }, + setInteger(integer) { + self.integer = integer; + }, + setFloat(float) { + self.float = float; + }, + setBoolean(boolean) { + self.boolean = boolean; + }, + setDate(date) { + self.date = date; + }, + })); + +ModelWithPrimitivesAndActions.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), +}).setInteger(2); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Create 1 model and set an integer value", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/create-1-model-and-set-an-integer-value-node-bundle.js b/build/create-1-model-and-set-an-integer-value-node-bundle.js new file mode 100644 index 0000000..b0453b9 --- /dev/null +++ b/build/create-1-model-and-set-an-integer-value-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-1-model-and-set-an-integer-value-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Ci?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Ci&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Ca=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Va={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Vi(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Create 1 model and set an integer value",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=Va.model({string:Va.string,number:Va.number,integer:Va.integer,float:Va.float,boolean:Va.boolean,date:Va.Date}).actions((e=>({setString(t){e.string=t},setNumber(t){e.number=t},setInteger(t){e.integer=t},setFloat(t){e.float=t},setBoolean(t){e.boolean=t},setDate(t){e.date=t}})));var r,n;t.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}).setInteger(2),r="Create 1 model and set an integer value",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[r]?ka[r]=Math.max(ka[r],n):ka[r]=n})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/create-1-model-and-set-an-integer-value-node-bundle.js.LICENSE.txt b/build/create-1-model-and-set-an-integer-value-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/create-1-model-and-set-an-integer-value-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/create-1-model-and-set-an-integer-value-web-bundle.js b/build/create-1-model-and-set-an-integer-value-web-bundle.js new file mode 100644 index 0000000..44c764d --- /dev/null +++ b/build/create-1-model-and-set-an-integer-value-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-1-model-and-set-an-integer-value-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw si("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw si(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw si("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw si("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw si("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw si(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw si("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw si("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw si("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw si("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw si("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw si(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw si(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw si("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw si("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw si("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw si("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw si("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw si("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function so(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw si("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||co)}var co=[void 0],fo=so(eo,void 0),po=so(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw si("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw si("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw si("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw si("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw si("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw si("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):so(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Create 1 model and set an integer value",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=No.model({string:No.string,number:No.number,integer:No.integer,float:No.float,boolean:No.boolean,date:No.Date}).actions((e=>({setString(t){e.string=t},setNumber(t){e.number=t},setInteger(t){e.integer=t},setFloat(t){e.float=t},setBoolean(t){e.boolean=t},setDate(t){e.date=t}})));var n,r;t.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}).setInteger(2),n="Create 1 model and set an integer value",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[n]?Ro[n]=Math.max(Ro[n],r):Ro[n]=r})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/create-1-model-and-set-an-integer-value-web-bundle.js.LICENSE.txt b/build/create-1-model-and-set-an-integer-value-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/create-1-model-and-set-an-integer-value-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/create-1-model-bundle-source.js b/build/create-1-model-bundle-source.js new file mode 100644 index 0000000..77d83dc --- /dev/null +++ b/build/create-1-model-bundle-source.js @@ -0,0 +1,122 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Create 1 model", () => { + const startMemory = getStartMemory(); + const ModelWithPrimitivesAndActions = types + .model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, + }) + .actions((self) => ({ + setString(string) { + self.string = string; + }, + setNumber(number) { + self.number = number; + }, + setInteger(integer) { + self.integer = integer; + }, + setFloat(float) { + self.float = float; + }, + setBoolean(boolean) { + self.boolean = boolean; + }, + setDate(date) { + self.date = date; + }, + })); + +ModelWithPrimitivesAndActions.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), +}); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Create 1 model", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/create-1-model-node-bundle.js b/build/create-1-model-node-bundle.js new file mode 100644 index 0000000..13901d8 --- /dev/null +++ b/build/create-1-model-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-1-model-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Ci?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Ci&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Ca=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Va={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Vi(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Create 1 model",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=Va.model({string:Va.string,number:Va.number,integer:Va.integer,float:Va.float,boolean:Va.boolean,date:Va.Date}).actions((e=>({setString(t){e.string=t},setNumber(t){e.number=t},setInteger(t){e.integer=t},setFloat(t){e.float=t},setBoolean(t){e.boolean=t},setDate(t){e.date=t}})));var r,n;t.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}),r="Create 1 model",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[r]?ka[r]=Math.max(ka[r],n):ka[r]=n})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/create-1-model-node-bundle.js.LICENSE.txt b/build/create-1-model-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/create-1-model-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/create-1-model-web-bundle.js b/build/create-1-model-web-bundle.js new file mode 100644 index 0000000..4d8494e --- /dev/null +++ b/build/create-1-model-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-1-model-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw si("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw si(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw si("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw si("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw si("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw si(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw si("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw si("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw si("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw si("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw si("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw si(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw si(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw si("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw si("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw si("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw si("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw si("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw si("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function so(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw si("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||co)}var co=[void 0],fo=so(eo,void 0),po=so(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw si("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw si("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw si("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw si("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw si("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw si("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):so(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Create 1 model",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=No.model({string:No.string,number:No.number,integer:No.integer,float:No.float,boolean:No.boolean,date:No.Date}).actions((e=>({setString(t){e.string=t},setNumber(t){e.number=t},setInteger(t){e.integer=t},setFloat(t){e.float=t},setBoolean(t){e.boolean=t},setDate(t){e.date=t}})));var n,r;t.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}),n="Create 1 model",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[n]?Ro[n]=Math.max(Ro[n],r):Ro[n]=r})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/create-1-model-web-bundle.js.LICENSE.txt b/build/create-1-model-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/create-1-model-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/create-10-models-bundle-source.js b/build/create-10-models-bundle-source.js new file mode 100644 index 0000000..8da3c91 --- /dev/null +++ b/build/create-10-models-bundle-source.js @@ -0,0 +1,124 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Create 10 models", () => { + const startMemory = getStartMemory(); + const ModelWithPrimitivesAndActions = types + .model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, + }) + .actions((self) => ({ + setString(string) { + self.string = string; + }, + setNumber(number) { + self.number = number; + }, + setInteger(integer) { + self.integer = integer; + }, + setFloat(float) { + self.float = float; + }, + setBoolean(boolean) { + self.boolean = boolean; + }, + setDate(date) { + self.date = date; + }, + })); + +for (let i = 0; i < 10; i++) { + ModelWithPrimitivesAndActions.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), + }); +} + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Create 10 models", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/create-10-models-node-bundle.js b/build/create-10-models-node-bundle.js new file mode 100644 index 0000000..3b71539 --- /dev/null +++ b/build/create-10-models-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-10-models-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Ci?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Ci&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Ca=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Va={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Vi(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Create 10 models",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=Va.model({string:Va.string,number:Va.number,integer:Va.integer,float:Va.float,boolean:Va.boolean,date:Va.Date}).actions((e=>({setString(t){e.string=t},setNumber(t){e.number=t},setInteger(t){e.integer=t},setFloat(t){e.float=t},setBoolean(t){e.boolean=t},setDate(t){e.date=t}})));for(let e=0;e<10;e++)t.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date});var r,n;r="Create 10 models",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[r]?ka[r]=Math.max(ka[r],n):ka[r]=n})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/create-10-models-node-bundle.js.LICENSE.txt b/build/create-10-models-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/create-10-models-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/create-10-models-web-bundle.js b/build/create-10-models-web-bundle.js new file mode 100644 index 0000000..38d0205 --- /dev/null +++ b/build/create-10-models-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-10-models-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw si("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw si(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw si("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw si("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw si("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw si(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw si("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw si("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw si("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw si("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw si("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw si(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw si(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw si("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw si("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw si("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw si("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw si("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw si("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function so(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw si("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||co)}var co=[void 0],fo=so(eo,void 0),po=so(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw si("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw si("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw si("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw si("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw si("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw si("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):so(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Create 10 models",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=No.model({string:No.string,number:No.number,integer:No.integer,float:No.float,boolean:No.boolean,date:No.Date}).actions((e=>({setString(t){e.string=t},setNumber(t){e.number=t},setInteger(t){e.integer=t},setFloat(t){e.float=t},setBoolean(t){e.boolean=t},setDate(t){e.date=t}})));for(let e=0;e<10;e++)t.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date});var n,r;n="Create 10 models",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[n]?Ro[n]=Math.max(Ro[n],r):Ro[n]=r})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/create-10-models-web-bundle.js.LICENSE.txt b/build/create-10-models-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/create-10-models-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/create-100-models-bundle-source.js b/build/create-100-models-bundle-source.js new file mode 100644 index 0000000..83c0105 --- /dev/null +++ b/build/create-100-models-bundle-source.js @@ -0,0 +1,124 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Create 100 models", () => { + const startMemory = getStartMemory(); + const ModelWithPrimitivesAndActions = types + .model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, + }) + .actions((self) => ({ + setString(string) { + self.string = string; + }, + setNumber(number) { + self.number = number; + }, + setInteger(integer) { + self.integer = integer; + }, + setFloat(float) { + self.float = float; + }, + setBoolean(boolean) { + self.boolean = boolean; + }, + setDate(date) { + self.date = date; + }, + })); + +for (let i = 0; i < 100; i++) { + ModelWithPrimitivesAndActions.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), + }); +} + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Create 100 models", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/create-100-models-node-bundle.js b/build/create-100-models-node-bundle.js new file mode 100644 index 0000000..1bf4cb9 --- /dev/null +++ b/build/create-100-models-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-100-models-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Ci?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Ci&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Ca=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Va={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Vi(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Create 100 models",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=Va.model({string:Va.string,number:Va.number,integer:Va.integer,float:Va.float,boolean:Va.boolean,date:Va.Date}).actions((e=>({setString(t){e.string=t},setNumber(t){e.number=t},setInteger(t){e.integer=t},setFloat(t){e.float=t},setBoolean(t){e.boolean=t},setDate(t){e.date=t}})));for(let e=0;e<100;e++)t.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date});var r,n;r="Create 100 models",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[r]?ka[r]=Math.max(ka[r],n):ka[r]=n})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/create-100-models-node-bundle.js.LICENSE.txt b/build/create-100-models-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/create-100-models-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/create-100-models-web-bundle.js b/build/create-100-models-web-bundle.js new file mode 100644 index 0000000..764abaa --- /dev/null +++ b/build/create-100-models-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-100-models-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw si("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw si(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw si("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw si("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw si("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw si(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw si("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw si("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw si("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw si("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw si("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw si(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw si(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw si("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw si("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw si("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw si("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw si("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw si("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function so(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw si("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||co)}var co=[void 0],fo=so(eo,void 0),po=so(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw si("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw si("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw si("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw si("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw si("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw si("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):so(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Create 100 models",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=No.model({string:No.string,number:No.number,integer:No.integer,float:No.float,boolean:No.boolean,date:No.Date}).actions((e=>({setString(t){e.string=t},setNumber(t){e.number=t},setInteger(t){e.integer=t},setFloat(t){e.float=t},setBoolean(t){e.boolean=t},setDate(t){e.date=t}})));for(let e=0;e<100;e++)t.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date});var n,r;n="Create 100 models",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[n]?Ro[n]=Math.max(Ro[n],r):Ro[n]=r})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/create-100-models-web-bundle.js.LICENSE.txt b/build/create-100-models-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/create-100-models-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/create-1000-models-bundle-source.js b/build/create-1000-models-bundle-source.js new file mode 100644 index 0000000..84a55c9 --- /dev/null +++ b/build/create-1000-models-bundle-source.js @@ -0,0 +1,124 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Create 1000 models", () => { + const startMemory = getStartMemory(); + const ModelWithPrimitivesAndActions = types + .model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, + }) + .actions((self) => ({ + setString(string) { + self.string = string; + }, + setNumber(number) { + self.number = number; + }, + setInteger(integer) { + self.integer = integer; + }, + setFloat(float) { + self.float = float; + }, + setBoolean(boolean) { + self.boolean = boolean; + }, + setDate(date) { + self.date = date; + }, + })); + +for (let i = 0; i < 1000; i++) { + ModelWithPrimitivesAndActions.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), + }); +} + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Create 1000 models", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/create-1000-models-node-bundle.js b/build/create-1000-models-node-bundle.js new file mode 100644 index 0000000..8306978 --- /dev/null +++ b/build/create-1000-models-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-1000-models-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Ci?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Ci&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Ca=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Va={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Vi(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Create 1000 models",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=Va.model({string:Va.string,number:Va.number,integer:Va.integer,float:Va.float,boolean:Va.boolean,date:Va.Date}).actions((e=>({setString(t){e.string=t},setNumber(t){e.number=t},setInteger(t){e.integer=t},setFloat(t){e.float=t},setBoolean(t){e.boolean=t},setDate(t){e.date=t}})));for(let e=0;e<1e3;e++)t.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date});var r,n;r="Create 1000 models",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[r]?ka[r]=Math.max(ka[r],n):ka[r]=n})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/create-1000-models-node-bundle.js.LICENSE.txt b/build/create-1000-models-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/create-1000-models-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/create-1000-models-web-bundle.js b/build/create-1000-models-web-bundle.js new file mode 100644 index 0000000..aa6ff9a --- /dev/null +++ b/build/create-1000-models-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-1000-models-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw si("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw si(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw si("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw si("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw si("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw si(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw si("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw si("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw si("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw si("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw si("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw si(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw si(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw si("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw si("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw si("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw si("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw si("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw si("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function so(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw si("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||co)}var co=[void 0],fo=so(eo,void 0),po=so(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw si("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw si("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw si("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw si("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw si("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw si("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):so(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Create 1000 models",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=No.model({string:No.string,number:No.number,integer:No.integer,float:No.float,boolean:No.boolean,date:No.Date}).actions((e=>({setString(t){e.string=t},setNumber(t){e.number=t},setInteger(t){e.integer=t},setFloat(t){e.float=t},setBoolean(t){e.boolean=t},setDate(t){e.date=t}})));for(let e=0;e<1e3;e++)t.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date});var n,r;n="Create 1000 models",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[n]?Ro[n]=Math.max(Ro[n],r):Ro[n]=r})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/create-1000-models-web-bundle.js.LICENSE.txt b/build/create-1000-models-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/create-1000-models-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/create-10000-models-bundle-source.js b/build/create-10000-models-bundle-source.js new file mode 100644 index 0000000..5ab43e5 --- /dev/null +++ b/build/create-10000-models-bundle-source.js @@ -0,0 +1,124 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Create 10000 models", () => { + const startMemory = getStartMemory(); + const ModelWithPrimitivesAndActions = types + .model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, + }) + .actions((self) => ({ + setString(string) { + self.string = string; + }, + setNumber(number) { + self.number = number; + }, + setInteger(integer) { + self.integer = integer; + }, + setFloat(float) { + self.float = float; + }, + setBoolean(boolean) { + self.boolean = boolean; + }, + setDate(date) { + self.date = date; + }, + })); + +for (let i = 0; i < 10000; i++) { + ModelWithPrimitivesAndActions.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), + }); +} + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Create 10000 models", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/create-10000-models-node-bundle.js b/build/create-10000-models-node-bundle.js new file mode 100644 index 0000000..2f131b6 --- /dev/null +++ b/build/create-10000-models-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-10000-models-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Ci?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Ci&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Ca=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Va={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Vi(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Create 10000 models",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=Va.model({string:Va.string,number:Va.number,integer:Va.integer,float:Va.float,boolean:Va.boolean,date:Va.Date}).actions((e=>({setString(t){e.string=t},setNumber(t){e.number=t},setInteger(t){e.integer=t},setFloat(t){e.float=t},setBoolean(t){e.boolean=t},setDate(t){e.date=t}})));for(let e=0;e<1e4;e++)t.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date});var r,n;r="Create 10000 models",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[r]?ka[r]=Math.max(ka[r],n):ka[r]=n})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/create-10000-models-node-bundle.js.LICENSE.txt b/build/create-10000-models-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/create-10000-models-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/create-10000-models-web-bundle.js b/build/create-10000-models-web-bundle.js new file mode 100644 index 0000000..67a6266 --- /dev/null +++ b/build/create-10000-models-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-10000-models-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw si("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw si(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw si("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw si("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw si("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw si(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw si("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw si("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw si("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw si("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw si("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw si(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw si(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw si("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw si("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw si("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw si("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw si("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw si("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function so(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw si("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||co)}var co=[void 0],fo=so(eo,void 0),po=so(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw si("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw si("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw si("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw si("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw si("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw si("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):so(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Create 10000 models",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=No.model({string:No.string,number:No.number,integer:No.integer,float:No.float,boolean:No.boolean,date:No.Date}).actions((e=>({setString(t){e.string=t},setNumber(t){e.number=t},setInteger(t){e.integer=t},setFloat(t){e.float=t},setBoolean(t){e.boolean=t},setDate(t){e.date=t}})));for(let e=0;e<1e4;e++)t.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date});var n,r;n="Create 10000 models",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[n]?Ro[n]=Math.max(Ro[n],r):Ro[n]=r})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/create-10000-models-web-bundle.js.LICENSE.txt b/build/create-10000-models-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/create-10000-models-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/create-100000-models-bundle-source.js b/build/create-100000-models-bundle-source.js new file mode 100644 index 0000000..e5fc85c --- /dev/null +++ b/build/create-100000-models-bundle-source.js @@ -0,0 +1,124 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Create 100000 models", () => { + const startMemory = getStartMemory(); + const ModelWithPrimitivesAndActions = types + .model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, + }) + .actions((self) => ({ + setString(string) { + self.string = string; + }, + setNumber(number) { + self.number = number; + }, + setInteger(integer) { + self.integer = integer; + }, + setFloat(float) { + self.float = float; + }, + setBoolean(boolean) { + self.boolean = boolean; + }, + setDate(date) { + self.date = date; + }, + })); + +for (let i = 0; i < 100000; i++) { + ModelWithPrimitivesAndActions.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), + }); +} + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Create 100000 models", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/create-100000-models-node-bundle.js b/build/create-100000-models-node-bundle.js new file mode 100644 index 0000000..12172f9 --- /dev/null +++ b/build/create-100000-models-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-100000-models-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Ci?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Ci&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Ca=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Va={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Vi(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Create 100000 models",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=Va.model({string:Va.string,number:Va.number,integer:Va.integer,float:Va.float,boolean:Va.boolean,date:Va.Date}).actions((e=>({setString(t){e.string=t},setNumber(t){e.number=t},setInteger(t){e.integer=t},setFloat(t){e.float=t},setBoolean(t){e.boolean=t},setDate(t){e.date=t}})));for(let e=0;e<1e5;e++)t.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date});var r,n;r="Create 100000 models",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[r]?ka[r]=Math.max(ka[r],n):ka[r]=n})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/create-100000-models-node-bundle.js.LICENSE.txt b/build/create-100000-models-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/create-100000-models-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/create-100000-models-web-bundle.js b/build/create-100000-models-web-bundle.js new file mode 100644 index 0000000..09dcaf3 --- /dev/null +++ b/build/create-100000-models-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-100000-models-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw si("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw si(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw si("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw si("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw si("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw si(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw si("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw si("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw si("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw si("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw si("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw si(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw si(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw si("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw si("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw si("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw si("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw si("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw si("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function so(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw si("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||co)}var co=[void 0],fo=so(eo,void 0),po=so(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw si("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw si("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw si("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw si("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw si("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw si("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):so(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Create 100000 models",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=No.model({string:No.string,number:No.number,integer:No.integer,float:No.float,boolean:No.boolean,date:No.Date}).actions((e=>({setString(t){e.string=t},setNumber(t){e.number=t},setInteger(t){e.integer=t},setFloat(t){e.float=t},setBoolean(t){e.boolean=t},setDate(t){e.date=t}})));for(let e=0;e<1e5;e++)t.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date});var n,r;n="Create 100000 models",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[n]?Ro[n]=Math.max(Ro[n],r):Ro[n]=r})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/create-100000-models-web-bundle.js.LICENSE.txt b/build/create-100000-models-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/create-100000-models-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/create-a-boolean-bundle-source.js b/build/create-a-boolean-bundle-source.js new file mode 100644 index 0000000..f77013c --- /dev/null +++ b/build/create-a-boolean-bundle-source.js @@ -0,0 +1,85 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Create a boolean", () => { + const startMemory = getStartMemory(); + types.boolean.create(true); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Create a boolean", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/create-a-boolean-node-bundle.js b/build/create-a-boolean-node-bundle.js new file mode 100644 index 0000000..19ab709 --- /dev/null +++ b/build/create-a-boolean-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-a-boolean-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Ci?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Ci&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Ca=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Va={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Vi(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Create a boolean",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,r;Va.boolean.create(!0),t="Create a boolean",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[t]?ka[t]=Math.max(ka[t],r):ka[t]=r})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/create-a-boolean-node-bundle.js.LICENSE.txt b/build/create-a-boolean-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/create-a-boolean-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/create-a-boolean-web-bundle.js b/build/create-a-boolean-web-bundle.js new file mode 100644 index 0000000..c187650 --- /dev/null +++ b/build/create-a-boolean-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-a-boolean-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw si("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw si(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw si("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw si("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw si("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw si(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw si("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw si("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw si("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw si("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw si("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw si(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw si(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw si("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw si("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw si("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw si("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw si("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw si("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function so(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw si("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||co)}var co=[void 0],fo=so(eo,void 0),po=so(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw si("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw si("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw si("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw si("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw si("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw si("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):so(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Create a boolean",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,n;No.boolean.create(!0),t="Create a boolean",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[t]?Ro[t]=Math.max(Ro[t],n):Ro[t]=n})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/create-a-boolean-web-bundle.js.LICENSE.txt b/build/create-a-boolean-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/create-a-boolean-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/create-a-date-bundle-source.js b/build/create-a-date-bundle-source.js new file mode 100644 index 0000000..258b377 --- /dev/null +++ b/build/create-a-date-bundle-source.js @@ -0,0 +1,85 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Create a date", () => { + const startMemory = getStartMemory(); + types.Date.create(new Date()); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Create a date", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/create-a-date-node-bundle.js b/build/create-a-date-node-bundle.js new file mode 100644 index 0000000..2082bb8 --- /dev/null +++ b/build/create-a-date-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-a-date-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Ci?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Ci&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Ca=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Va={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Vi(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Create a date",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,r;Va.Date.create(new Date),t="Create a date",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[t]?ka[t]=Math.max(ka[t],r):ka[t]=r})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/create-a-date-node-bundle.js.LICENSE.txt b/build/create-a-date-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/create-a-date-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/create-a-date-web-bundle.js b/build/create-a-date-web-bundle.js new file mode 100644 index 0000000..dd1ea71 --- /dev/null +++ b/build/create-a-date-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-a-date-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw si("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw si(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw si("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw si("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw si("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw si(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw si("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw si("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw si("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw si("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw si("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw si(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw si(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw si("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw si("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw si("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw si("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw si("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw si("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function so(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw si("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||co)}var co=[void 0],fo=so(eo,void 0),po=so(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw si("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw si("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw si("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw si("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw si("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw si("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):so(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Create a date",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,n;No.Date.create(new Date),t="Create a date",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[t]?Ro[t]=Math.max(Ro[t],n):Ro[t]=n})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/create-a-date-web-bundle.js.LICENSE.txt b/build/create-a-date-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/create-a-date-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/create-a-float-bundle-source.js b/build/create-a-float-bundle-source.js new file mode 100644 index 0000000..5588868 --- /dev/null +++ b/build/create-a-float-bundle-source.js @@ -0,0 +1,85 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Create a float", () => { + const startMemory = getStartMemory(); + types.float.create(1.1); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Create a float", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/create-a-float-node-bundle.js b/build/create-a-float-node-bundle.js new file mode 100644 index 0000000..34bf50f --- /dev/null +++ b/build/create-a-float-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-a-float-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Ci?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Ci&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Ca=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Va={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Vi(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Create a float",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,r;Va.float.create(1.1),t="Create a float",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[t]?ka[t]=Math.max(ka[t],r):ka[t]=r})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/create-a-float-node-bundle.js.LICENSE.txt b/build/create-a-float-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/create-a-float-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/create-a-float-web-bundle.js b/build/create-a-float-web-bundle.js new file mode 100644 index 0000000..efab96d --- /dev/null +++ b/build/create-a-float-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-a-float-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw si("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw si(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw si("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw si("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw si("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw si(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw si("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw si("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw si("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw si("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw si("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw si(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw si(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw si("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw si("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw si("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw si("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw si("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw si("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function so(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw si("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||co)}var co=[void 0],fo=so(eo,void 0),po=so(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw si("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw si("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw si("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw si("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw si("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw si("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):so(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Create a float",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,n;No.float.create(1.1),t="Create a float",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[t]?Ro[t]=Math.max(Ro[t],n):Ro[t]=n})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/create-a-float-web-bundle.js.LICENSE.txt b/build/create-a-float-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/create-a-float-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/create-a-map-type-with-one-boolean-in-it-bundle-source.js b/build/create-a-map-type-with-one-boolean-in-it-bundle-source.js new file mode 100644 index 0000000..8f020e0 --- /dev/null +++ b/build/create-a-map-type-with-one-boolean-in-it-bundle-source.js @@ -0,0 +1,85 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Create a map type with one boolean in it", () => { + const startMemory = getStartMemory(); + types.map(types.boolean).create({ boolean: true }); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Create a map type with one boolean in it", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/create-a-map-type-with-one-boolean-in-it-node-bundle.js b/build/create-a-map-type-with-one-boolean-in-it-node-bundle.js new file mode 100644 index 0000000..5fd51f3 --- /dev/null +++ b/build/create-a-map-type-with-one-boolean-in-it-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-a-map-type-with-one-boolean-in-it-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Ci?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Ci&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Ca=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Va={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Vi(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Create a map type with one boolean in it",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,r;Va.map(Va.boolean).create({boolean:!0}),t="Create a map type with one boolean in it",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[t]?ka[t]=Math.max(ka[t],r):ka[t]=r})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/create-a-map-type-with-one-boolean-in-it-node-bundle.js.LICENSE.txt b/build/create-a-map-type-with-one-boolean-in-it-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/create-a-map-type-with-one-boolean-in-it-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/create-a-map-type-with-one-boolean-in-it-web-bundle.js b/build/create-a-map-type-with-one-boolean-in-it-web-bundle.js new file mode 100644 index 0000000..ad70901 --- /dev/null +++ b/build/create-a-map-type-with-one-boolean-in-it-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-a-map-type-with-one-boolean-in-it-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw si("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw si(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw si("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw si("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw si("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw si(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw si("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw si("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw si("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw si("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw si("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw si(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw si(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw si("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw si("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw si("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw si("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw si("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw si("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function so(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw si("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||co)}var co=[void 0],fo=so(eo,void 0),po=so(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw si("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw si("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw si("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw si("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw si("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw si("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):so(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Create a map type with one boolean in it",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,n;No.map(No.boolean).create({boolean:!0}),t="Create a map type with one boolean in it",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[t]?Ro[t]=Math.max(Ro[t],n):Ro[t]=n})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/create-a-map-type-with-one-boolean-in-it-web-bundle.js.LICENSE.txt b/build/create-a-map-type-with-one-boolean-in-it-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/create-a-map-type-with-one-boolean-in-it-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/create-a-map-type-with-one-date-in-it-bundle-source.js b/build/create-a-map-type-with-one-date-in-it-bundle-source.js new file mode 100644 index 0000000..0394c1a --- /dev/null +++ b/build/create-a-map-type-with-one-date-in-it-bundle-source.js @@ -0,0 +1,85 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Create a map type with one Date in it", () => { + const startMemory = getStartMemory(); + types.map(types.Date).create({ date: new Date() }); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Create a map type with one Date in it", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/create-a-map-type-with-one-date-in-it-node-bundle.js b/build/create-a-map-type-with-one-date-in-it-node-bundle.js new file mode 100644 index 0000000..55f79f9 --- /dev/null +++ b/build/create-a-map-type-with-one-date-in-it-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-a-map-type-with-one-date-in-it-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Ci?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Ci&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Ca=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Va={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Vi(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Create a map type with one Date in it",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,r;Va.map(Va.Date).create({date:new Date}),t="Create a map type with one Date in it",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[t]?ka[t]=Math.max(ka[t],r):ka[t]=r})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/create-a-map-type-with-one-date-in-it-node-bundle.js.LICENSE.txt b/build/create-a-map-type-with-one-date-in-it-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/create-a-map-type-with-one-date-in-it-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/create-a-map-type-with-one-date-in-it-web-bundle.js b/build/create-a-map-type-with-one-date-in-it-web-bundle.js new file mode 100644 index 0000000..415a427 --- /dev/null +++ b/build/create-a-map-type-with-one-date-in-it-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-a-map-type-with-one-date-in-it-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw si("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw si(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw si("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw si("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw si("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw si(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw si("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw si("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw si("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw si("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw si("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw si(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw si(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw si("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw si("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw si("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw si("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw si("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw si("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function so(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw si("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||co)}var co=[void 0],fo=so(eo,void 0),po=so(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw si("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw si("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw si("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw si("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw si("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw si("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):so(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Create a map type with one Date in it",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,n;No.map(No.Date).create({date:new Date}),t="Create a map type with one Date in it",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[t]?Ro[t]=Math.max(Ro[t],n):Ro[t]=n})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/create-a-map-type-with-one-date-in-it-web-bundle.js.LICENSE.txt b/build/create-a-map-type-with-one-date-in-it-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/create-a-map-type-with-one-date-in-it-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/create-a-map-type-with-one-float-in-it-bundle-source.js b/build/create-a-map-type-with-one-float-in-it-bundle-source.js new file mode 100644 index 0000000..cbe41fd --- /dev/null +++ b/build/create-a-map-type-with-one-float-in-it-bundle-source.js @@ -0,0 +1,85 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Create a map type with one float in it", () => { + const startMemory = getStartMemory(); + types.map(types.float).create({ float: 1.1 }); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Create a map type with one float in it", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/create-a-map-type-with-one-float-in-it-node-bundle.js b/build/create-a-map-type-with-one-float-in-it-node-bundle.js new file mode 100644 index 0000000..bd8ea7a --- /dev/null +++ b/build/create-a-map-type-with-one-float-in-it-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-a-map-type-with-one-float-in-it-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Ci?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Ci&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Ca=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Va={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Vi(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Create a map type with one float in it",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,r;Va.map(Va.float).create({float:1.1}),t="Create a map type with one float in it",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[t]?ka[t]=Math.max(ka[t],r):ka[t]=r})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/create-a-map-type-with-one-float-in-it-node-bundle.js.LICENSE.txt b/build/create-a-map-type-with-one-float-in-it-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/create-a-map-type-with-one-float-in-it-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/create-a-map-type-with-one-float-in-it-web-bundle.js b/build/create-a-map-type-with-one-float-in-it-web-bundle.js new file mode 100644 index 0000000..c9c1d23 --- /dev/null +++ b/build/create-a-map-type-with-one-float-in-it-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-a-map-type-with-one-float-in-it-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw si("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw si(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw si("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw si("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw si("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw si(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw si("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw si("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw si("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw si("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw si("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw si(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw si(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw si("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw si("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw si("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw si("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw si("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw si("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function so(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw si("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||co)}var co=[void 0],fo=so(eo,void 0),po=so(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw si("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw si("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw si("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw si("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw si("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw si("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):so(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Create a map type with one float in it",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,n;No.map(No.float).create({float:1.1}),t="Create a map type with one float in it",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[t]?Ro[t]=Math.max(Ro[t],n):Ro[t]=n})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/create-a-map-type-with-one-float-in-it-web-bundle.js.LICENSE.txt b/build/create-a-map-type-with-one-float-in-it-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/create-a-map-type-with-one-float-in-it-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/create-a-map-type-with-one-integer-in-it-bundle-source.js b/build/create-a-map-type-with-one-integer-in-it-bundle-source.js new file mode 100644 index 0000000..626b592 --- /dev/null +++ b/build/create-a-map-type-with-one-integer-in-it-bundle-source.js @@ -0,0 +1,85 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Create a map type with one integer in it", () => { + const startMemory = getStartMemory(); + types.map(types.integer).create({ integer: 1 }); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Create a map type with one integer in it", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/create-a-map-type-with-one-integer-in-it-node-bundle.js b/build/create-a-map-type-with-one-integer-in-it-node-bundle.js new file mode 100644 index 0000000..48430e0 --- /dev/null +++ b/build/create-a-map-type-with-one-integer-in-it-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-a-map-type-with-one-integer-in-it-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Ci?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Ci&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Ca=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Va={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Vi(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Create a map type with one integer in it",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,r;Va.map(Va.integer).create({integer:1}),t="Create a map type with one integer in it",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[t]?ka[t]=Math.max(ka[t],r):ka[t]=r})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/create-a-map-type-with-one-integer-in-it-node-bundle.js.LICENSE.txt b/build/create-a-map-type-with-one-integer-in-it-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/create-a-map-type-with-one-integer-in-it-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/create-a-map-type-with-one-integer-in-it-web-bundle.js b/build/create-a-map-type-with-one-integer-in-it-web-bundle.js new file mode 100644 index 0000000..d3b8fe4 --- /dev/null +++ b/build/create-a-map-type-with-one-integer-in-it-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-a-map-type-with-one-integer-in-it-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw si("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw si(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw si("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw si("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw si("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw si(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw si("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw si("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw si("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw si("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw si("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw si(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw si(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw si("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw si("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw si("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw si("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw si("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw si("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function so(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw si("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||co)}var co=[void 0],fo=so(eo,void 0),po=so(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw si("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw si("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw si("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw si("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw si("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw si("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):so(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Create a map type with one integer in it",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,n;No.map(No.integer).create({integer:1}),t="Create a map type with one integer in it",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[t]?Ro[t]=Math.max(Ro[t],n):Ro[t]=n})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/create-a-map-type-with-one-integer-in-it-web-bundle.js.LICENSE.txt b/build/create-a-map-type-with-one-integer-in-it-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/create-a-map-type-with-one-integer-in-it-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/create-a-map-type-with-one-number-in-it-bundle-source.js b/build/create-a-map-type-with-one-number-in-it-bundle-source.js new file mode 100644 index 0000000..f9f03b6 --- /dev/null +++ b/build/create-a-map-type-with-one-number-in-it-bundle-source.js @@ -0,0 +1,85 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Create a map type with one number in it", () => { + const startMemory = getStartMemory(); + types.map(types.number).create({ number: 1 }); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Create a map type with one number in it", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/create-a-map-type-with-one-number-in-it-node-bundle.js b/build/create-a-map-type-with-one-number-in-it-node-bundle.js new file mode 100644 index 0000000..9732e87 --- /dev/null +++ b/build/create-a-map-type-with-one-number-in-it-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-a-map-type-with-one-number-in-it-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Ci?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Ci&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Ca=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Va={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Vi(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Create a map type with one number in it",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,r;Va.map(Va.number).create({number:1}),t="Create a map type with one number in it",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[t]?ka[t]=Math.max(ka[t],r):ka[t]=r})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/create-a-map-type-with-one-number-in-it-node-bundle.js.LICENSE.txt b/build/create-a-map-type-with-one-number-in-it-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/create-a-map-type-with-one-number-in-it-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/create-a-map-type-with-one-number-in-it-web-bundle.js b/build/create-a-map-type-with-one-number-in-it-web-bundle.js new file mode 100644 index 0000000..d44b64c --- /dev/null +++ b/build/create-a-map-type-with-one-number-in-it-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-a-map-type-with-one-number-in-it-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw si("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw si(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw si("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw si("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw si("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw si(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw si("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw si("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw si("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw si("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw si("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw si(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw si(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw si("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw si("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw si("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw si("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw si("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw si("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function so(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw si("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||co)}var co=[void 0],fo=so(eo,void 0),po=so(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw si("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw si("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw si("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw si("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw si("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw si("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):so(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Create a map type with one number in it",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,n;No.map(No.number).create({number:1}),t="Create a map type with one number in it",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[t]?Ro[t]=Math.max(Ro[t],n):Ro[t]=n})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/create-a-map-type-with-one-number-in-it-web-bundle.js.LICENSE.txt b/build/create-a-map-type-with-one-number-in-it-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/create-a-map-type-with-one-number-in-it-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/create-a-map-type-with-one-string-in-it-bundle-source.js b/build/create-a-map-type-with-one-string-in-it-bundle-source.js new file mode 100644 index 0000000..bffd3fb --- /dev/null +++ b/build/create-a-map-type-with-one-string-in-it-bundle-source.js @@ -0,0 +1,85 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Create a map type with one string in it", () => { + const startMemory = getStartMemory(); + types.map(types.string).create({ string: "string" }); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Create a map type with one string in it", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/create-a-map-type-with-one-string-in-it-node-bundle.js b/build/create-a-map-type-with-one-string-in-it-node-bundle.js new file mode 100644 index 0000000..b9612e4 --- /dev/null +++ b/build/create-a-map-type-with-one-string-in-it-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-a-map-type-with-one-string-in-it-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Ci?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Ci&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Ca=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Va={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Vi(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Create a map type with one string in it",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,r;Va.map(Va.string).create({string:"string"}),t="Create a map type with one string in it",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[t]?ka[t]=Math.max(ka[t],r):ka[t]=r})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/create-a-map-type-with-one-string-in-it-node-bundle.js.LICENSE.txt b/build/create-a-map-type-with-one-string-in-it-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/create-a-map-type-with-one-string-in-it-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/create-a-map-type-with-one-string-in-it-web-bundle.js b/build/create-a-map-type-with-one-string-in-it-web-bundle.js new file mode 100644 index 0000000..93b9b35 --- /dev/null +++ b/build/create-a-map-type-with-one-string-in-it-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-a-map-type-with-one-string-in-it-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,s=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),l=a.object&&e&&!e.nodeType&&e,c=s&&l&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(l&&l.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,l=e.Object,c=(e.RegExp,e.String),_=[],m=l.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,le(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=s&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,s={currentTarget:e},l={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),s.type="cycle",s.target=r,n=W(s),l.onCycle.call(e,n),n.aborted||!1===b())s.type="complete",l.onComplete.call(e,W(s));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function se(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function le(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,s=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+s+")"),fnArg:s,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}le=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,s=Z(u.fn),l=u.count=i.count,f=s||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||s);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=l)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=l}if(!v&&!a&&!y){v=o(u,f,a,d=(s||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=l,delete i.error}catch(e){u.count=l,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),le.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,s,l,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:le(t),l=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((s=W("error")).message=t.error,t.emit(s),s.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==l?1:-1:0):f<=(u<5||s<3?0:y[u][s-3])?f==l?1:-1:0},emit:oe,listeners:ae,off:ue,on:se,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,s=u.destination,l=s[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(l)||(r=!0,l=[]),l.length!=e.length&&(r=!0,(l=l.slice(0,e.length)).length=e.length)):t.isObjectLike(l)||(r=!0,l={}),r&&i.push({destination:s,key:n,value:l}),a.push({destination:l,source:e})):t.eq(l,e)||e===o||i.push({destination:s,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,s=[],l=e.stats.sample;function c(){s.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(s,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=l.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=l.length=s.length=0)),_||(f=q(l),y=t.reduce(l,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),s.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",s=32,l=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",l],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",s],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,se=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,le=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,st=parseInt,lt="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=lt||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&<.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=so(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,lt=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=so(t,"DataView"),jn=so(t,"Map"),Pn=so(t,"Promise"),Sn=so(t,"Set"),An=so(t,"WeakMap"),xn=so(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,s=1&t,l=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!s)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,s);if(p==P||p==d||h&&!o){if(u=l||h?{}:ho(e),!s)return l?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,lo(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,s)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?l?to:eo:l?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function sr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function lr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,s=[],l=t.length;if(!u)return s;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,s=u,l=r(u),c=1/0,f=[];s--;){var p=e[s];s&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),l[s]=!n&&(t||a>=120&&p.length>=120)?new Gn(s&&p):i}p=e[0];var h=-1,b=l[0];e:for(;++h=u?s:s*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,s,1),Ke.call(e,s,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):si(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,ns),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,s=e;null!=s&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var l=t?null:Gi(e);if(l)return sn(l);a=!1,i=Zt,s=new Gn}else s=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,s=null===t,l=t==t,c=uu(t);if(!s&&!c&&!a&&e>t||a&&u&&l&&!s&&!c||r&&u&&l||!n&&l||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!s&&"wrapper"==ro(u))var s=new Fn([],!0)}for(r=s?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof l&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?ts))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=lt||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,l,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=s}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=s}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,s,l,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,s=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);l=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return l=i,b&&r?d(e):(r=a=i,s)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(l===i)return function(e){return f=e,l=Eo(y,t),p?d(e):s}(c);if(h)return _i(l),l=Eo(y,t),d(c)}return l===i&&(l=Eo(y,t)),s}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){l!==i&&_i(l),f=0,r=c=a=l=i},_.flush=function(){return l===i?s:g(Sa())},_}var Ia=Kr((function(e,t){return sr(e,1,t)})),ka=Kr((function(e,t,n){return sr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||ds,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var su=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},lu=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?sn:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?st(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)si(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(se)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var es=Ri(),ts=Ri(!0);function ns(e){return e}function rs(e){return Nr("function"==typeof e?e:ar(e,1))}var is=Kr((function(e,t){return function(n){return Er(n,e,t)}})),os=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function as(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function us(){}var ss=Bi(It),ls=Bi(xt),cs=Bi(Dt);function fs(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var ps=Ui(),hs=Ui(!0);function bs(){return[]}function ds(){return!1}var vs,ys=zi((function(e,t){return e+t}),0),gs=Hi("ceil"),_s=zi((function(e,t){return e/t}),1),ms=Hi("floor"),ws=zi((function(e,t){return e*t}),1),Os=Hi("round"),js=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,s=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||su(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||si(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:li(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:li(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=sa,Ln.zip=la,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,as(Ln,Ln),Ln.add=ys,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gs,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_s,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ms,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=ns,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=su,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=lu,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,ns,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,ns)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,ns,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bs,Ln.stubFalse=ds,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=ws,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=us,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var s=n-cn(r);if(s<1)return r;var l=u?gi(u,0,s).join(""):e.slice(0,s);if(o===i)return l+r;if(u&&(s+=l.length-s),iu(o)){if(e.slice(s).search(o)){var c,f=l;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;l=l.slice(0,p===i?s:p)}}else if(e.indexOf(ai(o),s)!=s){var h=l.lastIndexOf(o);h>-1&&(l=l.slice(0,h))}return l+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,as(Ln,(vs={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vs[t]=e)})),vs),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(ns)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,s=t instanceof Un,l=u[0],c=s||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof l&&1!=l.length&&(s=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=s&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,s=a&&u&&"object"==typeof n.g&&n.g;!s||s.global!==s&&s.window!==s&&s.self!==s||(o=s);var l=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=l)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(l=n)?typeof l[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!l[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),s=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!s?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!s?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var s=t[o];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=n[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)lt(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,s=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var l=Vt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(s,l);e.then(c,n)}e=n,s(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function sn(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=l),an(this)){var o=sn(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return l;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=sn(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!sn(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=ln(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=ln(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=ln(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return lr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return lr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var s=r.value;if(!i.has(s))if(n.delete(s))a=!0;else{var l=n.data_.get(s);o.set(s,l)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!sn(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=ln(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!sn(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=ln(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return lr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=sr(e),t=sr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function sr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function lr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var s=a._childNodes[a.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw li(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var s,l,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(s=r.onError,l=n,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw li(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],si));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw li("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(r),s=!0)}s&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw li(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw li(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw li("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw li("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function lo(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new so(e,t,n||co)}var co=[void 0],fo=lo(eo,void 0),po=lo(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw li("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):lo(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Create a map type with one string in it",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,n;No.map(No.string).create({string:"string"}),t="Create a map type with one string in it",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[t]?Ro[t]=Math.max(Ro[t],n):Ro[t]=n})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/create-a-map-type-with-one-string-in-it-web-bundle.js.LICENSE.txt b/build/create-a-map-type-with-one-string-in-it-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/create-a-map-type-with-one-string-in-it-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/create-a-model-and-add-actions-and-views-to-it-bundle-source.js b/build/create-a-model-and-add-actions-and-views-to-it-bundle-source.js new file mode 100644 index 0000000..45d41af --- /dev/null +++ b/build/create-a-model-and-add-actions-and-views-to-it-bundle-source.js @@ -0,0 +1,133 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Create a model and add actions and views to it", () => { + const startMemory = getStartMemory(); + const Model = types + .model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, + }) + .actions((self) => ({ + setString: (string) => { + self.string = string; + }, + setNumber: (number) => { + self.number = number; + }, + setInteger: (integer) => { + self.integer = integer; + }, + setFloat: (float) => { + self.float = float; + }, + setBoolean: (boolean) => { + self.boolean = boolean; + }, + setDate: (date) => { + self.date = date; + }, + })) + .views((self) => ({ + getString: () => { + return self.string; + }, + getNumber: () => { + return self.number; + }, + getInteger: () => { + return self.integer; + }, + getFloat: () => { + return self.float; + }, + getBoolean: () => { + return self.boolean; + }, + getDate: () => { + return self.date; + }, + })); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Create a model and add actions and views to it", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/create-a-model-and-add-actions-and-views-to-it-node-bundle.js b/build/create-a-model-and-add-actions-and-views-to-it-node-bundle.js new file mode 100644 index 0000000..e0aff21 --- /dev/null +++ b/build/create-a-model-and-add-actions-and-views-to-it-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-a-model-and-add-actions-and-views-to-it-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Ci?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Ci&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Ca=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Va={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Vi(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Create a model and add actions and views to it",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,r;Va.model({string:Va.string,number:Va.number,integer:Va.integer,float:Va.float,boolean:Va.boolean,date:Va.Date}).actions((e=>({setString:t=>{e.string=t},setNumber:t=>{e.number=t},setInteger:t=>{e.integer=t},setFloat:t=>{e.float=t},setBoolean:t=>{e.boolean=t},setDate:t=>{e.date=t}}))).views((e=>({getString:()=>e.string,getNumber:()=>e.number,getInteger:()=>e.integer,getFloat:()=>e.float,getBoolean:()=>e.boolean,getDate:()=>e.date}))),t="Create a model and add actions and views to it",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[t]?ka[t]=Math.max(ka[t],r):ka[t]=r})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/create-a-model-and-add-actions-and-views-to-it-node-bundle.js.LICENSE.txt b/build/create-a-model-and-add-actions-and-views-to-it-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/create-a-model-and-add-actions-and-views-to-it-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/create-a-model-and-add-actions-and-views-to-it-web-bundle.js b/build/create-a-model-and-add-actions-and-views-to-it-web-bundle.js new file mode 100644 index 0000000..36350bb --- /dev/null +++ b/build/create-a-model-and-add-actions-and-views-to-it-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-a-model-and-add-actions-and-views-to-it-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,s=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),l=a.object&&e&&!e.nodeType&&e,c=s&&l&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(l&&l.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,l=e.Object,c=(e.RegExp,e.String),_=[],m=l.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,le(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=s&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,s={currentTarget:e},l={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),s.type="cycle",s.target=r,n=W(s),l.onCycle.call(e,n),n.aborted||!1===b())s.type="complete",l.onComplete.call(e,W(s));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function se(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function le(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,s=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+s+")"),fnArg:s,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}le=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,s=Z(u.fn),l=u.count=i.count,f=s||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||s);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=l)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=l}if(!v&&!a&&!y){v=o(u,f,a,d=(s||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=l,delete i.error}catch(e){u.count=l,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),le.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,s,l,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:le(t),l=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((s=W("error")).message=t.error,t.emit(s),s.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==l?1:-1:0):f<=(u<5||s<3?0:y[u][s-3])?f==l?1:-1:0},emit:oe,listeners:ae,off:ue,on:se,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,s=u.destination,l=s[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(l)||(r=!0,l=[]),l.length!=e.length&&(r=!0,(l=l.slice(0,e.length)).length=e.length)):t.isObjectLike(l)||(r=!0,l={}),r&&i.push({destination:s,key:n,value:l}),a.push({destination:l,source:e})):t.eq(l,e)||e===o||i.push({destination:s,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,s=[],l=e.stats.sample;function c(){s.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(s,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=l.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=l.length=s.length=0)),_||(f=q(l),y=t.reduce(l,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),s.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",s=32,l=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",l],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",s],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,se=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,le=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,st=parseInt,lt="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=lt||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&<.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=so(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,lt=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=so(t,"DataView"),jn=so(t,"Map"),Pn=so(t,"Promise"),Sn=so(t,"Set"),An=so(t,"WeakMap"),xn=so(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,s=1&t,l=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!s)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,s);if(p==P||p==d||h&&!o){if(u=l||h?{}:ho(e),!s)return l?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,lo(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,s)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?l?to:eo:l?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function sr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function lr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,s=[],l=t.length;if(!u)return s;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,s=u,l=r(u),c=1/0,f=[];s--;){var p=e[s];s&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),l[s]=!n&&(t||a>=120&&p.length>=120)?new Gn(s&&p):i}p=e[0];var h=-1,b=l[0];e:for(;++h=u?s:s*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,s,1),Ke.call(e,s,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):si(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,ns),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,s=e;null!=s&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var l=t?null:Gi(e);if(l)return sn(l);a=!1,i=Zt,s=new Gn}else s=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,s=null===t,l=t==t,c=uu(t);if(!s&&!c&&!a&&e>t||a&&u&&l&&!s&&!c||r&&u&&l||!n&&l||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!s&&"wrapper"==ro(u))var s=new Fn([],!0)}for(r=s?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof l&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?ts))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=lt||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,l,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=s}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=s}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,s,l,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,s=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);l=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return l=i,b&&r?d(e):(r=a=i,s)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(l===i)return function(e){return f=e,l=Eo(y,t),p?d(e):s}(c);if(h)return _i(l),l=Eo(y,t),d(c)}return l===i&&(l=Eo(y,t)),s}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){l!==i&&_i(l),f=0,r=c=a=l=i},_.flush=function(){return l===i?s:g(Sa())},_}var Ia=Kr((function(e,t){return sr(e,1,t)})),ka=Kr((function(e,t,n){return sr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||ds,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var su=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},lu=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?sn:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?st(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)si(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(se)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var es=Ri(),ts=Ri(!0);function ns(e){return e}function rs(e){return Nr("function"==typeof e?e:ar(e,1))}var is=Kr((function(e,t){return function(n){return Er(n,e,t)}})),os=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function as(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function us(){}var ss=Bi(It),ls=Bi(xt),cs=Bi(Dt);function fs(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var ps=Ui(),hs=Ui(!0);function bs(){return[]}function ds(){return!1}var vs,ys=zi((function(e,t){return e+t}),0),gs=Hi("ceil"),_s=zi((function(e,t){return e/t}),1),ms=Hi("floor"),ws=zi((function(e,t){return e*t}),1),Os=Hi("round"),js=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,s=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||su(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||si(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:li(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:li(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=sa,Ln.zip=la,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,as(Ln,Ln),Ln.add=ys,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gs,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_s,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ms,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=ns,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=su,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=lu,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,ns,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,ns)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,ns,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bs,Ln.stubFalse=ds,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=ws,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=us,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var s=n-cn(r);if(s<1)return r;var l=u?gi(u,0,s).join(""):e.slice(0,s);if(o===i)return l+r;if(u&&(s+=l.length-s),iu(o)){if(e.slice(s).search(o)){var c,f=l;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;l=l.slice(0,p===i?s:p)}}else if(e.indexOf(ai(o),s)!=s){var h=l.lastIndexOf(o);h>-1&&(l=l.slice(0,h))}return l+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,as(Ln,(vs={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vs[t]=e)})),vs),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(ns)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,s=t instanceof Un,l=u[0],c=s||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof l&&1!=l.length&&(s=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=s&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,s=a&&u&&"object"==typeof n.g&&n.g;!s||s.global!==s&&s.window!==s&&s.self!==s||(o=s);var l=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=l)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(l=n)?typeof l[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!l[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),s=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!s?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!s?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var s=t[o];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=n[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)lt(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,s=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var l=Vt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(s,l);e.then(c,n)}e=n,s(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function sn(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=l),an(this)){var o=sn(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return l;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=sn(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!sn(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=ln(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=ln(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=ln(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return lr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return lr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var s=r.value;if(!i.has(s))if(n.delete(s))a=!0;else{var l=n.data_.get(s);o.set(s,l)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!sn(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=ln(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!sn(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=ln(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return lr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=sr(e),t=sr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function sr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function lr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var s=a._childNodes[a.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw li(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var s,l,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(s=r.onError,l=n,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw li(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],si));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw li("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(r),s=!0)}s&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw li(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw li(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw li("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw li("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function lo(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new so(e,t,n||co)}var co=[void 0],fo=lo(eo,void 0),po=lo(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw li("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):lo(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Create a model and add actions and views to it",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,n;No.model({string:No.string,number:No.number,integer:No.integer,float:No.float,boolean:No.boolean,date:No.Date}).actions((e=>({setString:t=>{e.string=t},setNumber:t=>{e.number=t},setInteger:t=>{e.integer=t},setFloat:t=>{e.float=t},setBoolean:t=>{e.boolean=t},setDate:t=>{e.date=t}}))).views((e=>({getString:()=>e.string,getNumber:()=>e.number,getInteger:()=>e.integer,getFloat:()=>e.float,getBoolean:()=>e.boolean,getDate:()=>e.date}))),t="Create a model and add actions and views to it",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[t]?Ro[t]=Math.max(Ro[t],n):Ro[t]=n})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/create-a-model-and-add-actions-and-views-to-it-web-bundle.js.LICENSE.txt b/build/create-a-model-and-add-actions-and-views-to-it-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/create-a-model-and-add-actions-and-views-to-it-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/create-a-model-and-add-actions-to-it-bundle-source.js b/build/create-a-model-and-add-actions-to-it-bundle-source.js new file mode 100644 index 0000000..b071675 --- /dev/null +++ b/build/create-a-model-and-add-actions-to-it-bundle-source.js @@ -0,0 +1,113 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Create a model and add actions to it", () => { + const startMemory = getStartMemory(); + const Model = types + .model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, + }) + .actions((self) => ({ + setString: (string) => { + self.string = string; + }, + setNumber: (number) => { + self.number = number; + }, + setInteger: (integer) => { + self.integer = integer; + }, + setFloat: (float) => { + self.float = float; + }, + setBoolean: (boolean) => { + self.boolean = boolean; + }, + setDate: (date) => { + self.date = date; + }, + })); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Create a model and add actions to it", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/create-a-model-and-add-actions-to-it-node-bundle.js b/build/create-a-model-and-add-actions-to-it-node-bundle.js new file mode 100644 index 0000000..37e220f --- /dev/null +++ b/build/create-a-model-and-add-actions-to-it-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-a-model-and-add-actions-to-it-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Ci?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Ci&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Ca=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Va={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Vi(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Create a model and add actions to it",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,r;Va.model({string:Va.string,number:Va.number,integer:Va.integer,float:Va.float,boolean:Va.boolean,date:Va.Date}).actions((e=>({setString:t=>{e.string=t},setNumber:t=>{e.number=t},setInteger:t=>{e.integer=t},setFloat:t=>{e.float=t},setBoolean:t=>{e.boolean=t},setDate:t=>{e.date=t}}))),t="Create a model and add actions to it",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[t]?ka[t]=Math.max(ka[t],r):ka[t]=r})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/create-a-model-and-add-actions-to-it-node-bundle.js.LICENSE.txt b/build/create-a-model-and-add-actions-to-it-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/create-a-model-and-add-actions-to-it-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/create-a-model-and-add-actions-to-it-web-bundle.js b/build/create-a-model-and-add-actions-to-it-web-bundle.js new file mode 100644 index 0000000..41ee15f --- /dev/null +++ b/build/create-a-model-and-add-actions-to-it-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-a-model-and-add-actions-to-it-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,s=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),l=a.object&&e&&!e.nodeType&&e,c=s&&l&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(l&&l.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,l=e.Object,c=(e.RegExp,e.String),_=[],m=l.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,le(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=s&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,s={currentTarget:e},l={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),s.type="cycle",s.target=r,n=W(s),l.onCycle.call(e,n),n.aborted||!1===b())s.type="complete",l.onComplete.call(e,W(s));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function se(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function le(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,s=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+s+")"),fnArg:s,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}le=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,s=Z(u.fn),l=u.count=i.count,f=s||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||s);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=l)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=l}if(!v&&!a&&!y){v=o(u,f,a,d=(s||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=l,delete i.error}catch(e){u.count=l,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),le.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,s,l,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:le(t),l=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((s=W("error")).message=t.error,t.emit(s),s.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==l?1:-1:0):f<=(u<5||s<3?0:y[u][s-3])?f==l?1:-1:0},emit:oe,listeners:ae,off:ue,on:se,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,s=u.destination,l=s[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(l)||(r=!0,l=[]),l.length!=e.length&&(r=!0,(l=l.slice(0,e.length)).length=e.length)):t.isObjectLike(l)||(r=!0,l={}),r&&i.push({destination:s,key:n,value:l}),a.push({destination:l,source:e})):t.eq(l,e)||e===o||i.push({destination:s,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,s=[],l=e.stats.sample;function c(){s.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(s,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=l.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=l.length=s.length=0)),_||(f=q(l),y=t.reduce(l,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),s.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",s=32,l=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",l],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",s],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,se=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,le=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,st=parseInt,lt="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=lt||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&<.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=so(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,lt=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=so(t,"DataView"),jn=so(t,"Map"),Pn=so(t,"Promise"),Sn=so(t,"Set"),An=so(t,"WeakMap"),xn=so(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,s=1&t,l=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!s)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,s);if(p==P||p==d||h&&!o){if(u=l||h?{}:ho(e),!s)return l?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,lo(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,s)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?l?to:eo:l?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function sr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function lr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,s=[],l=t.length;if(!u)return s;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,s=u,l=r(u),c=1/0,f=[];s--;){var p=e[s];s&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),l[s]=!n&&(t||a>=120&&p.length>=120)?new Gn(s&&p):i}p=e[0];var h=-1,b=l[0];e:for(;++h=u?s:s*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,s,1),Ke.call(e,s,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):si(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,ns),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,s=e;null!=s&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var l=t?null:Gi(e);if(l)return sn(l);a=!1,i=Zt,s=new Gn}else s=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,s=null===t,l=t==t,c=uu(t);if(!s&&!c&&!a&&e>t||a&&u&&l&&!s&&!c||r&&u&&l||!n&&l||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!s&&"wrapper"==ro(u))var s=new Fn([],!0)}for(r=s?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof l&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?ts))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=lt||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,l,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=s}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=s}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,s,l,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,s=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);l=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return l=i,b&&r?d(e):(r=a=i,s)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(l===i)return function(e){return f=e,l=Eo(y,t),p?d(e):s}(c);if(h)return _i(l),l=Eo(y,t),d(c)}return l===i&&(l=Eo(y,t)),s}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){l!==i&&_i(l),f=0,r=c=a=l=i},_.flush=function(){return l===i?s:g(Sa())},_}var Ia=Kr((function(e,t){return sr(e,1,t)})),ka=Kr((function(e,t,n){return sr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||ds,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var su=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},lu=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?sn:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?st(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)si(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(se)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var es=Ri(),ts=Ri(!0);function ns(e){return e}function rs(e){return Nr("function"==typeof e?e:ar(e,1))}var is=Kr((function(e,t){return function(n){return Er(n,e,t)}})),os=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function as(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function us(){}var ss=Bi(It),ls=Bi(xt),cs=Bi(Dt);function fs(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var ps=Ui(),hs=Ui(!0);function bs(){return[]}function ds(){return!1}var vs,ys=zi((function(e,t){return e+t}),0),gs=Hi("ceil"),_s=zi((function(e,t){return e/t}),1),ms=Hi("floor"),ws=zi((function(e,t){return e*t}),1),Os=Hi("round"),js=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,s=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||su(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||si(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:li(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:li(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=sa,Ln.zip=la,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,as(Ln,Ln),Ln.add=ys,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gs,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_s,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ms,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=ns,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=su,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=lu,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,ns,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,ns)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,ns,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bs,Ln.stubFalse=ds,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=ws,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=us,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var s=n-cn(r);if(s<1)return r;var l=u?gi(u,0,s).join(""):e.slice(0,s);if(o===i)return l+r;if(u&&(s+=l.length-s),iu(o)){if(e.slice(s).search(o)){var c,f=l;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;l=l.slice(0,p===i?s:p)}}else if(e.indexOf(ai(o),s)!=s){var h=l.lastIndexOf(o);h>-1&&(l=l.slice(0,h))}return l+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,as(Ln,(vs={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vs[t]=e)})),vs),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(ns)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,s=t instanceof Un,l=u[0],c=s||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof l&&1!=l.length&&(s=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=s&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,s=a&&u&&"object"==typeof n.g&&n.g;!s||s.global!==s&&s.window!==s&&s.self!==s||(o=s);var l=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=l)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(l=n)?typeof l[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!l[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),s=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!s?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!s?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var s=t[o];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=n[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)lt(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,s=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var l=Vt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(s,l);e.then(c,n)}e=n,s(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function sn(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=l),an(this)){var o=sn(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return l;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=sn(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!sn(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=ln(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=ln(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=ln(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return lr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return lr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var s=r.value;if(!i.has(s))if(n.delete(s))a=!0;else{var l=n.data_.get(s);o.set(s,l)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!sn(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=ln(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!sn(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=ln(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return lr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=sr(e),t=sr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function sr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function lr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var s=a._childNodes[a.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw li(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var s,l,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(s=r.onError,l=n,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw li(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],si));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw li("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(r),s=!0)}s&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw li(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw li(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw li("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw li("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function lo(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new so(e,t,n||co)}var co=[void 0],fo=lo(eo,void 0),po=lo(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw li("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):lo(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Create a model and add actions to it",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,n;No.model({string:No.string,number:No.number,integer:No.integer,float:No.float,boolean:No.boolean,date:No.Date}).actions((e=>({setString:t=>{e.string=t},setNumber:t=>{e.number=t},setInteger:t=>{e.integer=t},setFloat:t=>{e.float=t},setBoolean:t=>{e.boolean=t},setDate:t=>{e.date=t}}))),t="Create a model and add actions to it",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[t]?Ro[t]=Math.max(Ro[t],n):Ro[t]=n})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/create-a-model-and-add-actions-to-it-web-bundle.js.LICENSE.txt b/build/create-a-model-and-add-actions-to-it-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/create-a-model-and-add-actions-to-it-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/create-a-model-and-add-views-to-it-bundle-source.js b/build/create-a-model-and-add-views-to-it-bundle-source.js new file mode 100644 index 0000000..9a136a1 --- /dev/null +++ b/build/create-a-model-and-add-views-to-it-bundle-source.js @@ -0,0 +1,113 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Create a model and add views to it", () => { + const startMemory = getStartMemory(); + const Model = types + .model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, + }) + .views((self) => ({ + getString: () => { + return self.string; + }, + getNumber: () => { + return self.number; + }, + getInteger: () => { + return self.integer; + }, + getFloat: () => { + return self.float; + }, + getBoolean: () => { + return self.boolean; + }, + getDate: () => { + return self.date; + }, + })); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Create a model and add views to it", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/create-a-model-and-add-views-to-it-node-bundle.js b/build/create-a-model-and-add-views-to-it-node-bundle.js new file mode 100644 index 0000000..1d0f0d4 --- /dev/null +++ b/build/create-a-model-and-add-views-to-it-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-a-model-and-add-views-to-it-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Ci?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Ci&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Ca=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Va={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Vi(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Create a model and add views to it",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,r;Va.model({string:Va.string,number:Va.number,integer:Va.integer,float:Va.float,boolean:Va.boolean,date:Va.Date}).views((e=>({getString:()=>e.string,getNumber:()=>e.number,getInteger:()=>e.integer,getFloat:()=>e.float,getBoolean:()=>e.boolean,getDate:()=>e.date}))),t="Create a model and add views to it",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[t]?ka[t]=Math.max(ka[t],r):ka[t]=r})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/create-a-model-and-add-views-to-it-node-bundle.js.LICENSE.txt b/build/create-a-model-and-add-views-to-it-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/create-a-model-and-add-views-to-it-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/create-a-model-and-add-views-to-it-web-bundle.js b/build/create-a-model-and-add-views-to-it-web-bundle.js new file mode 100644 index 0000000..7f35a06 --- /dev/null +++ b/build/create-a-model-and-add-views-to-it-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-a-model-and-add-views-to-it-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw si("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw si(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw si("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw si("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw si("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw si(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw si("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw si("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw si("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw si("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw si("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw si(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw si(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw si("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw si("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw si("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw si("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw si("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw si("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function so(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw si("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||co)}var co=[void 0],fo=so(eo,void 0),po=so(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw si("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw si("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw si("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw si("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw si("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw si("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):so(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Create a model and add views to it",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,n;No.model({string:No.string,number:No.number,integer:No.integer,float:No.float,boolean:No.boolean,date:No.Date}).views((e=>({getString:()=>e.string,getNumber:()=>e.number,getInteger:()=>e.integer,getFloat:()=>e.float,getBoolean:()=>e.boolean,getDate:()=>e.date}))),t="Create a model and add views to it",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[t]?Ro[t]=Math.max(Ro[t],n):Ro[t]=n})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/create-a-model-and-add-views-to-it-web-bundle.js.LICENSE.txt b/build/create-a-model-and-add-views-to-it-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/create-a-model-and-add-views-to-it-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/create-a-model-with-a-snapshot-listener-bundle-source.js b/build/create-a-model-with-a-snapshot-listener-bundle-source.js new file mode 100644 index 0000000..4497e27 --- /dev/null +++ b/build/create-a-model-with-a-snapshot-listener-bundle-source.js @@ -0,0 +1,107 @@ + +import { types, getSnapshot, applySnapshot, onSnapshot } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Create a model with a snapshot listener", () => { + const startMemory = getStartMemory(); + const Model = types.model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, +}); + +const m = Model.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), +}); + +onSnapshot(m, (snapshot) => { + return snapshot; +}); + +return m; + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Create a model with a snapshot listener", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/create-a-model-with-a-snapshot-listener-node-bundle.js b/build/create-a-model-with-a-snapshot-listener-node-bundle.js new file mode 100644 index 0000000..6f834fc --- /dev/null +++ b/build/create-a-model-with-a-snapshot-listener-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-a-model-with-a-snapshot-listener-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Xe(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Je(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(X(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Xt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Jt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Jt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Xt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Xn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Jn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Ci?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Ci&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Xt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Jn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Jn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Jn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Ca=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Va={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Vi(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Create a model with a snapshot listener",(()=>{void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;const e=Va.model({string:Va.string,number:Va.number,integer:Va.integer,float:Va.float,boolean:Va.boolean,date:Va.Date}).create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date});var t,r;return r=e=>e,Qn(t=e),ei(t).onSnapshot(r),e})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/create-a-model-with-a-snapshot-listener-node-bundle.js.LICENSE.txt b/build/create-a-model-with-a-snapshot-listener-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/create-a-model-with-a-snapshot-listener-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/create-a-model-with-a-snapshot-listener-web-bundle.js b/build/create-a-model-with-a-snapshot-listener-web-bundle.js new file mode 100644 index 0000000..e9ba1de --- /dev/null +++ b/build/create-a-model-with-a-snapshot-listener-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-a-model-with-a-snapshot-listener-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw si("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw si(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw si("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw si("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw si("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw si(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw si("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw si("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw si("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw si("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw si("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw si(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw si(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw si("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw si("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw si("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw si("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw si("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw si("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function so(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw si("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||co)}var co=[void 0],fo=so(eo,void 0),po=so(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw si("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw si("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw si("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw si("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw si("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw si("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):so(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Create a model with a snapshot listener",(()=>{void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;const e=No.model({string:No.string,number:No.number,integer:No.integer,float:No.float,boolean:No.boolean,date:No.Date}).create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date});var t,n;return n=e=>e,Qr(t=e),ei(t).onSnapshot(n),e})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/create-a-model-with-a-snapshot-listener-web-bundle.js.LICENSE.txt b/build/create-a-model-with-a-snapshot-listener-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/create-a-model-with-a-snapshot-listener-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/create-a-number-bundle-source.js b/build/create-a-number-bundle-source.js new file mode 100644 index 0000000..bdaeb2d --- /dev/null +++ b/build/create-a-number-bundle-source.js @@ -0,0 +1,85 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Create a number", () => { + const startMemory = getStartMemory(); + types.number.create(1); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Create a number", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/create-a-number-node-bundle.js b/build/create-a-number-node-bundle.js new file mode 100644 index 0000000..764ff0b --- /dev/null +++ b/build/create-a-number-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-a-number-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Ci?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Ci&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Ca=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Va={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Vi(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Create a number",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,r;Va.number.create(1),t="Create a number",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[t]?ka[t]=Math.max(ka[t],r):ka[t]=r})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/create-a-number-node-bundle.js.LICENSE.txt b/build/create-a-number-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/create-a-number-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/create-a-number-web-bundle.js b/build/create-a-number-web-bundle.js new file mode 100644 index 0000000..9c6603e --- /dev/null +++ b/build/create-a-number-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-a-number-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw si("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw si(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw si("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw si("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw si("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw si(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw si("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw si("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw si("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw si("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw si("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw si(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw si(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw si("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw si("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw si("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw si("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw si("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw si("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function so(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw si("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||co)}var co=[void 0],fo=so(eo,void 0),po=so(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw si("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw si("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw si("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw si("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw si("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw si("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):so(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Create a number",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,n;No.number.create(1),t="Create a number",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[t]?Ro[t]=Math.max(Ro[t],n):Ro[t]=n})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/create-a-number-web-bundle.js.LICENSE.txt b/build/create-a-number-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/create-a-number-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/create-a-string-bundle-source.js b/build/create-a-string-bundle-source.js new file mode 100644 index 0000000..b95556e --- /dev/null +++ b/build/create-a-string-bundle-source.js @@ -0,0 +1,85 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Create a string", () => { + const startMemory = getStartMemory(); + types.string.create("string"); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Create a string", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/create-a-string-node-bundle.js b/build/create-a-string-node-bundle.js new file mode 100644 index 0000000..f017afc --- /dev/null +++ b/build/create-a-string-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-a-string-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Ci?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Ci&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Ca=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Va={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Vi(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Create a string",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,r;Va.string.create("string"),t="Create a string",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[t]?ka[t]=Math.max(ka[t],r):ka[t]=r})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/create-a-string-node-bundle.js.LICENSE.txt b/build/create-a-string-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/create-a-string-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/create-a-string-web-bundle.js b/build/create-a-string-web-bundle.js new file mode 100644 index 0000000..04b4f66 --- /dev/null +++ b/build/create-a-string-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-a-string-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,s=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),l=a.object&&e&&!e.nodeType&&e,c=s&&l&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(l&&l.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,l=e.Object,c=(e.RegExp,e.String),_=[],m=l.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,le(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=s&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,s={currentTarget:e},l={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),s.type="cycle",s.target=r,n=W(s),l.onCycle.call(e,n),n.aborted||!1===b())s.type="complete",l.onComplete.call(e,W(s));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function se(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function le(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,s=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+s+")"),fnArg:s,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}le=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,s=Z(u.fn),l=u.count=i.count,f=s||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||s);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=l)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=l}if(!v&&!a&&!y){v=o(u,f,a,d=(s||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=l,delete i.error}catch(e){u.count=l,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),le.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,s,l,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:le(t),l=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((s=W("error")).message=t.error,t.emit(s),s.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==l?1:-1:0):f<=(u<5||s<3?0:y[u][s-3])?f==l?1:-1:0},emit:oe,listeners:ae,off:ue,on:se,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,s=u.destination,l=s[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(l)||(r=!0,l=[]),l.length!=e.length&&(r=!0,(l=l.slice(0,e.length)).length=e.length)):t.isObjectLike(l)||(r=!0,l={}),r&&i.push({destination:s,key:n,value:l}),a.push({destination:l,source:e})):t.eq(l,e)||e===o||i.push({destination:s,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,s=[],l=e.stats.sample;function c(){s.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(s,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=l.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=l.length=s.length=0)),_||(f=q(l),y=t.reduce(l,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),s.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",s=32,l=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",l],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",s],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,se=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,le=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,st=parseInt,lt="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=lt||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&<.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=so(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,lt=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=so(t,"DataView"),jn=so(t,"Map"),Pn=so(t,"Promise"),Sn=so(t,"Set"),An=so(t,"WeakMap"),xn=so(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,s=1&t,l=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!s)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,s);if(p==P||p==d||h&&!o){if(u=l||h?{}:ho(e),!s)return l?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,lo(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,s)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?l?to:eo:l?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function sr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function lr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,s=[],l=t.length;if(!u)return s;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,s=u,l=r(u),c=1/0,f=[];s--;){var p=e[s];s&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),l[s]=!n&&(t||a>=120&&p.length>=120)?new Gn(s&&p):i}p=e[0];var h=-1,b=l[0];e:for(;++h=u?s:s*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,s,1),Ke.call(e,s,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):si(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,ns),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,s=e;null!=s&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var l=t?null:Gi(e);if(l)return sn(l);a=!1,i=Zt,s=new Gn}else s=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,s=null===t,l=t==t,c=uu(t);if(!s&&!c&&!a&&e>t||a&&u&&l&&!s&&!c||r&&u&&l||!n&&l||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!s&&"wrapper"==ro(u))var s=new Fn([],!0)}for(r=s?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof l&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?ts))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=lt||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,l,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=s}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=s}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,s,l,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,s=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);l=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return l=i,b&&r?d(e):(r=a=i,s)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(l===i)return function(e){return f=e,l=Eo(y,t),p?d(e):s}(c);if(h)return _i(l),l=Eo(y,t),d(c)}return l===i&&(l=Eo(y,t)),s}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){l!==i&&_i(l),f=0,r=c=a=l=i},_.flush=function(){return l===i?s:g(Sa())},_}var Ia=Kr((function(e,t){return sr(e,1,t)})),ka=Kr((function(e,t,n){return sr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||ds,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var su=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},lu=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?sn:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?st(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)si(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(se)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var es=Ri(),ts=Ri(!0);function ns(e){return e}function rs(e){return Nr("function"==typeof e?e:ar(e,1))}var is=Kr((function(e,t){return function(n){return Er(n,e,t)}})),os=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function as(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function us(){}var ss=Bi(It),ls=Bi(xt),cs=Bi(Dt);function fs(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var ps=Ui(),hs=Ui(!0);function bs(){return[]}function ds(){return!1}var vs,ys=zi((function(e,t){return e+t}),0),gs=Hi("ceil"),_s=zi((function(e,t){return e/t}),1),ms=Hi("floor"),ws=zi((function(e,t){return e*t}),1),Os=Hi("round"),js=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,s=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||su(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||si(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:li(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:li(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=sa,Ln.zip=la,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,as(Ln,Ln),Ln.add=ys,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gs,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_s,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ms,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=ns,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=su,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=lu,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,ns,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,ns)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,ns,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bs,Ln.stubFalse=ds,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=ws,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=us,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var s=n-cn(r);if(s<1)return r;var l=u?gi(u,0,s).join(""):e.slice(0,s);if(o===i)return l+r;if(u&&(s+=l.length-s),iu(o)){if(e.slice(s).search(o)){var c,f=l;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;l=l.slice(0,p===i?s:p)}}else if(e.indexOf(ai(o),s)!=s){var h=l.lastIndexOf(o);h>-1&&(l=l.slice(0,h))}return l+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,as(Ln,(vs={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vs[t]=e)})),vs),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(ns)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,s=t instanceof Un,l=u[0],c=s||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof l&&1!=l.length&&(s=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=s&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,s=a&&u&&"object"==typeof n.g&&n.g;!s||s.global!==s&&s.window!==s&&s.self!==s||(o=s);var l=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=l)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(l=n)?typeof l[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!l[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),s=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!s?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!s?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var s=t[o];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=n[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)lt(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,s=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var l=Vt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(s,l);e.then(c,n)}e=n,s(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function sn(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=l),an(this)){var o=sn(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return l;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=sn(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!sn(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=ln(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=ln(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=ln(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return lr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return lr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var s=r.value;if(!i.has(s))if(n.delete(s))a=!0;else{var l=n.data_.get(s);o.set(s,l)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!sn(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=ln(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!sn(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=ln(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return lr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=sr(e),t=sr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function sr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function lr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var s=a._childNodes[a.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw li(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var s,l,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(s=r.onError,l=n,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw li(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],si));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw li("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(r),s=!0)}s&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw li(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw li(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw li("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw li("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function lo(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new so(e,t,n||co)}var co=[void 0],fo=lo(eo,void 0),po=lo(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw li("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):lo(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Create a string",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,n;No.string.create("string"),t="Create a string",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[t]?Ro[t]=Math.max(Ro[t],n):Ro[t]=n})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/create-a-string-web-bundle.js.LICENSE.txt b/build/create-a-string-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/create-a-string-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/create-an-array-type-with-one-boolean-bundle-source.js b/build/create-an-array-type-with-one-boolean-bundle-source.js new file mode 100644 index 0000000..7c1eeb5 --- /dev/null +++ b/build/create-an-array-type-with-one-boolean-bundle-source.js @@ -0,0 +1,85 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Create an array type with one boolean", () => { + const startMemory = getStartMemory(); + types.array(types.integer).create([true]); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Create an array type with one boolean", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/create-an-array-type-with-one-boolean-node-bundle.js b/build/create-an-array-type-with-one-boolean-node-bundle.js new file mode 100644 index 0000000..a5e8a86 --- /dev/null +++ b/build/create-an-array-type-with-one-boolean-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-an-array-type-with-one-boolean-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Ci?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Ci&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Ca=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Va={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Vi(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Create an array type with one boolean",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,r;Va.array(Va.integer).create([!0]),t="Create an array type with one boolean",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[t]?ka[t]=Math.max(ka[t],r):ka[t]=r})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/create-an-array-type-with-one-boolean-node-bundle.js.LICENSE.txt b/build/create-an-array-type-with-one-boolean-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/create-an-array-type-with-one-boolean-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/create-an-array-type-with-one-boolean-web-bundle.js b/build/create-an-array-type-with-one-boolean-web-bundle.js new file mode 100644 index 0000000..f08e0a8 --- /dev/null +++ b/build/create-an-array-type-with-one-boolean-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-an-array-type-with-one-boolean-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw si("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw si(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw si("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw si("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw si("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw si(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw si("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw si("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw si("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw si("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw si("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw si(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw si(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw si("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw si("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw si("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw si("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw si("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw si("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function so(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw si("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||co)}var co=[void 0],fo=so(eo,void 0),po=so(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw si("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw si("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw si("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw si("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw si("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw si("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):so(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Create an array type with one boolean",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,n;No.array(No.integer).create([!0]),t="Create an array type with one boolean",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[t]?Ro[t]=Math.max(Ro[t],n):Ro[t]=n})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/create-an-array-type-with-one-boolean-web-bundle.js.LICENSE.txt b/build/create-an-array-type-with-one-boolean-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/create-an-array-type-with-one-boolean-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/create-an-array-type-with-one-date-bundle-source.js b/build/create-an-array-type-with-one-date-bundle-source.js new file mode 100644 index 0000000..edbb2d3 --- /dev/null +++ b/build/create-an-array-type-with-one-date-bundle-source.js @@ -0,0 +1,85 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Create an array type with one Date", () => { + const startMemory = getStartMemory(); + types.array(types.Date).create([new Date()]); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Create an array type with one Date", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/create-an-array-type-with-one-date-node-bundle.js b/build/create-an-array-type-with-one-date-node-bundle.js new file mode 100644 index 0000000..6639667 --- /dev/null +++ b/build/create-an-array-type-with-one-date-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-an-array-type-with-one-date-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Ci?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Ci&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Ca=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Va={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Vi(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Create an array type with one Date",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,r;Va.array(Va.Date).create([new Date]),t="Create an array type with one Date",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[t]?ka[t]=Math.max(ka[t],r):ka[t]=r})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/create-an-array-type-with-one-date-node-bundle.js.LICENSE.txt b/build/create-an-array-type-with-one-date-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/create-an-array-type-with-one-date-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/create-an-array-type-with-one-date-web-bundle.js b/build/create-an-array-type-with-one-date-web-bundle.js new file mode 100644 index 0000000..b2c2809 --- /dev/null +++ b/build/create-an-array-type-with-one-date-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-an-array-type-with-one-date-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw si("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw si(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw si("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw si("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw si("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw si(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw si("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw si("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw si("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw si("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw si("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw si(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw si(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw si("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw si("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw si("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw si("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw si("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw si("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function so(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw si("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||co)}var co=[void 0],fo=so(eo,void 0),po=so(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw si("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw si("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw si("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw si("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw si("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw si("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):so(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Create an array type with one Date",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,n;No.array(No.Date).create([new Date]),t="Create an array type with one Date",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[t]?Ro[t]=Math.max(Ro[t],n):Ro[t]=n})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/create-an-array-type-with-one-date-web-bundle.js.LICENSE.txt b/build/create-an-array-type-with-one-date-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/create-an-array-type-with-one-date-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/create-an-array-type-with-one-float-bundle-source.js b/build/create-an-array-type-with-one-float-bundle-source.js new file mode 100644 index 0000000..b4d65ab --- /dev/null +++ b/build/create-an-array-type-with-one-float-bundle-source.js @@ -0,0 +1,85 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Create an array type with one float", () => { + const startMemory = getStartMemory(); + types.array(types.integer).create([1.0]); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Create an array type with one float", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/create-an-array-type-with-one-float-node-bundle.js b/build/create-an-array-type-with-one-float-node-bundle.js new file mode 100644 index 0000000..cfc72fe --- /dev/null +++ b/build/create-an-array-type-with-one-float-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-an-array-type-with-one-float-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Ci?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Ci&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Ca=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Va={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Vi(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Create an array type with one float",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,r;Va.array(Va.integer).create([1]),t="Create an array type with one float",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[t]?ka[t]=Math.max(ka[t],r):ka[t]=r})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/create-an-array-type-with-one-float-node-bundle.js.LICENSE.txt b/build/create-an-array-type-with-one-float-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/create-an-array-type-with-one-float-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/create-an-array-type-with-one-float-web-bundle.js b/build/create-an-array-type-with-one-float-web-bundle.js new file mode 100644 index 0000000..a887bba --- /dev/null +++ b/build/create-an-array-type-with-one-float-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-an-array-type-with-one-float-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw si("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw si(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw si("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw si("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw si("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw si(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw si("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw si("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw si("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw si("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw si("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw si(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw si(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw si("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw si("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw si("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw si("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw si("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw si("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function so(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw si("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||co)}var co=[void 0],fo=so(eo,void 0),po=so(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw si("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw si("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw si("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw si("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw si("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw si("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):so(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Create an array type with one float",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,n;No.array(No.integer).create([1]),t="Create an array type with one float",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[t]?Ro[t]=Math.max(Ro[t],n):Ro[t]=n})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/create-an-array-type-with-one-float-web-bundle.js.LICENSE.txt b/build/create-an-array-type-with-one-float-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/create-an-array-type-with-one-float-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/create-an-array-type-with-one-integer-bundle-source.js b/build/create-an-array-type-with-one-integer-bundle-source.js new file mode 100644 index 0000000..4b2b5b7 --- /dev/null +++ b/build/create-an-array-type-with-one-integer-bundle-source.js @@ -0,0 +1,85 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Create an array type with one integer", () => { + const startMemory = getStartMemory(); + types.array(types.integer).create([1]); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Create an array type with one integer", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/create-an-array-type-with-one-integer-node-bundle.js b/build/create-an-array-type-with-one-integer-node-bundle.js new file mode 100644 index 0000000..963b411 --- /dev/null +++ b/build/create-an-array-type-with-one-integer-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-an-array-type-with-one-integer-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Ci?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Ci&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Ca=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Va={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Vi(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Create an array type with one integer",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,r;Va.array(Va.integer).create([1]),t="Create an array type with one integer",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[t]?ka[t]=Math.max(ka[t],r):ka[t]=r})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/create-an-array-type-with-one-integer-node-bundle.js.LICENSE.txt b/build/create-an-array-type-with-one-integer-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/create-an-array-type-with-one-integer-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/create-an-array-type-with-one-integer-web-bundle.js b/build/create-an-array-type-with-one-integer-web-bundle.js new file mode 100644 index 0000000..9f4d8ba --- /dev/null +++ b/build/create-an-array-type-with-one-integer-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-an-array-type-with-one-integer-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw si("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw si(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw si("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw si("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw si("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw si(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw si("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw si("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw si("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw si("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw si("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw si(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw si(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw si("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw si("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw si("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw si("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw si("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw si("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function so(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw si("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||co)}var co=[void 0],fo=so(eo,void 0),po=so(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw si("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw si("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw si("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw si("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw si("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw si("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):so(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Create an array type with one integer",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,n;No.array(No.integer).create([1]),t="Create an array type with one integer",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[t]?Ro[t]=Math.max(Ro[t],n):Ro[t]=n})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/create-an-array-type-with-one-integer-web-bundle.js.LICENSE.txt b/build/create-an-array-type-with-one-integer-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/create-an-array-type-with-one-integer-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/create-an-array-type-with-one-number-bundle-source.js b/build/create-an-array-type-with-one-number-bundle-source.js new file mode 100644 index 0000000..5de1669 --- /dev/null +++ b/build/create-an-array-type-with-one-number-bundle-source.js @@ -0,0 +1,85 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Create an array type with one number", () => { + const startMemory = getStartMemory(); + types.array(types.number).create([1]); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Create an array type with one number", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/create-an-array-type-with-one-number-node-bundle.js b/build/create-an-array-type-with-one-number-node-bundle.js new file mode 100644 index 0000000..ac6e933 --- /dev/null +++ b/build/create-an-array-type-with-one-number-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-an-array-type-with-one-number-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Ci?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Ci&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Ca=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Va={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Vi(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Create an array type with one number",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,r;Va.array(Va.number).create([1]),t="Create an array type with one number",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[t]?ka[t]=Math.max(ka[t],r):ka[t]=r})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/create-an-array-type-with-one-number-node-bundle.js.LICENSE.txt b/build/create-an-array-type-with-one-number-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/create-an-array-type-with-one-number-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/create-an-array-type-with-one-number-web-bundle.js b/build/create-an-array-type-with-one-number-web-bundle.js new file mode 100644 index 0000000..ce87385 --- /dev/null +++ b/build/create-an-array-type-with-one-number-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-an-array-type-with-one-number-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw si("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw si(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw si("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw si("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw si("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw si(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw si("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw si("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw si("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw si("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw si("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw si(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw si(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw si("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw si("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw si("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw si("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw si("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw si("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function so(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw si("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||co)}var co=[void 0],fo=so(eo,void 0),po=so(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw si("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw si("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw si("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw si("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw si("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw si("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):so(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Create an array type with one number",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,n;No.array(No.number).create([1]),t="Create an array type with one number",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[t]?Ro[t]=Math.max(Ro[t],n):Ro[t]=n})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/create-an-array-type-with-one-number-web-bundle.js.LICENSE.txt b/build/create-an-array-type-with-one-number-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/create-an-array-type-with-one-number-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/create-an-array-type-with-one-string-bundle-source.js b/build/create-an-array-type-with-one-string-bundle-source.js new file mode 100644 index 0000000..3ac2821 --- /dev/null +++ b/build/create-an-array-type-with-one-string-bundle-source.js @@ -0,0 +1,85 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Create an array type with one string", () => { + const startMemory = getStartMemory(); + types.array(types.string).create(["string"]); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Create an array type with one string", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/create-an-array-type-with-one-string-node-bundle.js b/build/create-an-array-type-with-one-string-node-bundle.js new file mode 100644 index 0000000..bc65e78 --- /dev/null +++ b/build/create-an-array-type-with-one-string-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-an-array-type-with-one-string-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Ci?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Ci&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Ca=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Va={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Vi(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Create an array type with one string",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,r;Va.array(Va.string).create(["string"]),t="Create an array type with one string",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[t]?ka[t]=Math.max(ka[t],r):ka[t]=r})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/create-an-array-type-with-one-string-node-bundle.js.LICENSE.txt b/build/create-an-array-type-with-one-string-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/create-an-array-type-with-one-string-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/create-an-array-type-with-one-string-web-bundle.js b/build/create-an-array-type-with-one-string-web-bundle.js new file mode 100644 index 0000000..53bc4a2 --- /dev/null +++ b/build/create-an-array-type-with-one-string-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-an-array-type-with-one-string-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,s=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),l=a.object&&e&&!e.nodeType&&e,c=s&&l&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(l&&l.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,l=e.Object,c=(e.RegExp,e.String),_=[],m=l.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,le(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=s&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,s={currentTarget:e},l={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),s.type="cycle",s.target=r,n=W(s),l.onCycle.call(e,n),n.aborted||!1===b())s.type="complete",l.onComplete.call(e,W(s));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function se(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function le(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,s=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+s+")"),fnArg:s,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}le=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,s=Z(u.fn),l=u.count=i.count,f=s||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||s);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=l)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=l}if(!v&&!a&&!y){v=o(u,f,a,d=(s||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=l,delete i.error}catch(e){u.count=l,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),le.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,s,l,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:le(t),l=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((s=W("error")).message=t.error,t.emit(s),s.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==l?1:-1:0):f<=(u<5||s<3?0:y[u][s-3])?f==l?1:-1:0},emit:oe,listeners:ae,off:ue,on:se,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,s=u.destination,l=s[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(l)||(r=!0,l=[]),l.length!=e.length&&(r=!0,(l=l.slice(0,e.length)).length=e.length)):t.isObjectLike(l)||(r=!0,l={}),r&&i.push({destination:s,key:n,value:l}),a.push({destination:l,source:e})):t.eq(l,e)||e===o||i.push({destination:s,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,s=[],l=e.stats.sample;function c(){s.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(s,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=l.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=l.length=s.length=0)),_||(f=q(l),y=t.reduce(l,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),s.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",s=32,l=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",l],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",s],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,se=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,le=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,st=parseInt,lt="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=lt||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&<.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=so(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,lt=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=so(t,"DataView"),jn=so(t,"Map"),Pn=so(t,"Promise"),Sn=so(t,"Set"),An=so(t,"WeakMap"),xn=so(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,s=1&t,l=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!s)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,s);if(p==P||p==d||h&&!o){if(u=l||h?{}:ho(e),!s)return l?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,lo(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,s)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?l?to:eo:l?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function sr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function lr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,s=[],l=t.length;if(!u)return s;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,s=u,l=r(u),c=1/0,f=[];s--;){var p=e[s];s&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),l[s]=!n&&(t||a>=120&&p.length>=120)?new Gn(s&&p):i}p=e[0];var h=-1,b=l[0];e:for(;++h=u?s:s*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,s,1),Ke.call(e,s,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):si(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,ns),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,s=e;null!=s&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var l=t?null:Gi(e);if(l)return sn(l);a=!1,i=Zt,s=new Gn}else s=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,s=null===t,l=t==t,c=uu(t);if(!s&&!c&&!a&&e>t||a&&u&&l&&!s&&!c||r&&u&&l||!n&&l||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!s&&"wrapper"==ro(u))var s=new Fn([],!0)}for(r=s?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof l&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?ts))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=lt||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,l,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=s}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=s}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,s,l,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,s=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);l=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return l=i,b&&r?d(e):(r=a=i,s)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(l===i)return function(e){return f=e,l=Eo(y,t),p?d(e):s}(c);if(h)return _i(l),l=Eo(y,t),d(c)}return l===i&&(l=Eo(y,t)),s}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){l!==i&&_i(l),f=0,r=c=a=l=i},_.flush=function(){return l===i?s:g(Sa())},_}var Ia=Kr((function(e,t){return sr(e,1,t)})),ka=Kr((function(e,t,n){return sr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||ds,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var su=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},lu=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?sn:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?st(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)si(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(se)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var es=Ri(),ts=Ri(!0);function ns(e){return e}function rs(e){return Nr("function"==typeof e?e:ar(e,1))}var is=Kr((function(e,t){return function(n){return Er(n,e,t)}})),os=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function as(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function us(){}var ss=Bi(It),ls=Bi(xt),cs=Bi(Dt);function fs(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var ps=Ui(),hs=Ui(!0);function bs(){return[]}function ds(){return!1}var vs,ys=zi((function(e,t){return e+t}),0),gs=Hi("ceil"),_s=zi((function(e,t){return e/t}),1),ms=Hi("floor"),ws=zi((function(e,t){return e*t}),1),Os=Hi("round"),js=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,s=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||su(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||si(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:li(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:li(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=sa,Ln.zip=la,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,as(Ln,Ln),Ln.add=ys,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gs,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_s,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ms,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=ns,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=su,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=lu,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,ns,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,ns)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,ns,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bs,Ln.stubFalse=ds,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=ws,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=us,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var s=n-cn(r);if(s<1)return r;var l=u?gi(u,0,s).join(""):e.slice(0,s);if(o===i)return l+r;if(u&&(s+=l.length-s),iu(o)){if(e.slice(s).search(o)){var c,f=l;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;l=l.slice(0,p===i?s:p)}}else if(e.indexOf(ai(o),s)!=s){var h=l.lastIndexOf(o);h>-1&&(l=l.slice(0,h))}return l+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,as(Ln,(vs={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vs[t]=e)})),vs),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(ns)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,s=t instanceof Un,l=u[0],c=s||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof l&&1!=l.length&&(s=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=s&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,s=a&&u&&"object"==typeof n.g&&n.g;!s||s.global!==s&&s.window!==s&&s.self!==s||(o=s);var l=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=l)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(l=n)?typeof l[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!l[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),s=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!s?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!s?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var s=t[o];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=n[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)lt(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,s=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var l=Vt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(s,l);e.then(c,n)}e=n,s(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function sn(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=l),an(this)){var o=sn(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return l;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=sn(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!sn(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=ln(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=ln(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=ln(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return lr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return lr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var s=r.value;if(!i.has(s))if(n.delete(s))a=!0;else{var l=n.data_.get(s);o.set(s,l)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!sn(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=ln(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!sn(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=ln(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return lr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=sr(e),t=sr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function sr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function lr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var s=a._childNodes[a.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw li(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var s,l,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(s=r.onError,l=n,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw li(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],si));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw li("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(r),s=!0)}s&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw li(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw li(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw li("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw li("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function lo(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new so(e,t,n||co)}var co=[void 0],fo=lo(eo,void 0),po=lo(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw li("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):lo(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Create an array type with one string",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,n;No.array(No.string).create(["string"]),t="Create an array type with one string",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[t]?Ro[t]=Math.max(Ro[t],n):Ro[t]=n})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/create-an-array-type-with-one-string-web-bundle.js.LICENSE.txt b/build/create-an-array-type-with-one-string-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/create-an-array-type-with-one-string-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/create-an-integer-bundle-source.js b/build/create-an-integer-bundle-source.js new file mode 100644 index 0000000..9b736b7 --- /dev/null +++ b/build/create-an-integer-bundle-source.js @@ -0,0 +1,85 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Create an integer", () => { + const startMemory = getStartMemory(); + types.integer.create(1); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Create an integer", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/create-an-integer-node-bundle.js b/build/create-an-integer-node-bundle.js new file mode 100644 index 0000000..410fd2d --- /dev/null +++ b/build/create-an-integer-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-an-integer-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Ci?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Ci&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Ca=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Va={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Vi(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Create an integer",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,r;Va.integer.create(1),t="Create an integer",r=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[t]?ka[t]=Math.max(ka[t],r):ka[t]=r})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/create-an-integer-node-bundle.js.LICENSE.txt b/build/create-an-integer-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/create-an-integer-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/create-an-integer-web-bundle.js b/build/create-an-integer-web-bundle.js new file mode 100644 index 0000000..c142efa --- /dev/null +++ b/build/create-an-integer-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see create-an-integer-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw si("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw si(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw si("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw si("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw si("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw si(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw si("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw si("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw si("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw si("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw si("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw si(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw si(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw si("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw si("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw si("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw si("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw si("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw si("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function so(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw si("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||co)}var co=[void 0],fo=so(eo,void 0),po=so(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw si("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw si("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw si("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw si("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw si("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw si("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):so(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Create an integer",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;var t,n;No.integer.create(1),t="Create an integer",n=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[t]?Ro[t]=Math.max(Ro[t],n):Ro[t]=n})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/create-an-integer-web-bundle.js.LICENSE.txt b/build/create-an-integer-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/create-an-integer-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/execute-a-simple-snapshot-listener-bundle-source.js b/build/execute-a-simple-snapshot-listener-bundle-source.js new file mode 100644 index 0000000..c1914d3 --- /dev/null +++ b/build/execute-a-simple-snapshot-listener-bundle-source.js @@ -0,0 +1,117 @@ + +import { types, getSnapshot, applySnapshot, onSnapshot } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Execute a simple snapshot listener", () => { + const startMemory = getStartMemory(); + const Model = types + .model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, + }) + .actions((self) => { + const changeString = (newString) => { + self.string = newString; + }; + + return { + changeString, + }; + }); + +const m = Model.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), +}); + +onSnapshot(m, (snapshot) => { + return snapshot; +}); + +m.changeString("newString"); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Execute a simple snapshot listener", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/execute-a-simple-snapshot-listener-node-bundle.js b/build/execute-a-simple-snapshot-listener-node-bundle.js new file mode 100644 index 0000000..2deca37 --- /dev/null +++ b/build/execute-a-simple-snapshot-listener-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see execute-a-simple-snapshot-listener-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Je(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(J(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Vt(e){return v(e)&&!0===e.isMobxAction}function Ct(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Vr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Vr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Jt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Vr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Vr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Ct((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Vr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Vr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},C(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Vr=P("ObservableMap",Nr),Cr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Cr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Vr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Jt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Vr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Jn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Vi?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Vi&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Cn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Vn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Jt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Cn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Vn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Va=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Ca={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Ci(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Execute a simple snapshot listener",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=Ca.model({string:Ca.string,number:Ca.number,integer:Ca.integer,float:Ca.float,boolean:Ca.boolean,date:Ca.Date}).actions((e=>({changeString:t=>{e.string=t}}))).create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date});var r,n,i,a;n=e=>e,Qn(r=t),ei(r).onSnapshot(n),t.changeString("newString"),i="Execute a simple snapshot listener",a=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,ka[i]?ka[i]=Math.max(ka[i],a):ka[i]=a})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/execute-a-simple-snapshot-listener-node-bundle.js.LICENSE.txt b/build/execute-a-simple-snapshot-listener-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/execute-a-simple-snapshot-listener-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/execute-a-simple-snapshot-listener-web-bundle.js b/build/execute-a-simple-snapshot-listener-web-bundle.js new file mode 100644 index 0000000..8adcb32 --- /dev/null +++ b/build/execute-a-simple-snapshot-listener-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see execute-a-simple-snapshot-listener-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,s=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),l=a.object&&e&&!e.nodeType&&e,c=s&&l&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(l&&l.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,l=e.Object,c=(e.RegExp,e.String),_=[],m=l.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,le(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=s&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,s={currentTarget:e},l={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),s.type="cycle",s.target=r,n=W(s),l.onCycle.call(e,n),n.aborted||!1===b())s.type="complete",l.onComplete.call(e,W(s));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function se(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function le(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,s=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+s+")"),fnArg:s,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}le=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,s=Z(u.fn),l=u.count=i.count,f=s||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||s);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=l)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=l}if(!v&&!a&&!y){v=o(u,f,a,d=(s||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=l,delete i.error}catch(e){u.count=l,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),le.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,s,l,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:le(t),l=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((s=W("error")).message=t.error,t.emit(s),s.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==l?1:-1:0):f<=(u<5||s<3?0:y[u][s-3])?f==l?1:-1:0},emit:oe,listeners:ae,off:ue,on:se,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,s=u.destination,l=s[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(l)||(r=!0,l=[]),l.length!=e.length&&(r=!0,(l=l.slice(0,e.length)).length=e.length)):t.isObjectLike(l)||(r=!0,l={}),r&&i.push({destination:s,key:n,value:l}),a.push({destination:l,source:e})):t.eq(l,e)||e===o||i.push({destination:s,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,s=[],l=e.stats.sample;function c(){s.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(s,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=l.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=l.length=s.length=0)),_||(f=q(l),y=t.reduce(l,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),s.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",s=32,l=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",l],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",s],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,se=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,le=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,st=parseInt,lt="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=lt||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&<.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=so(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,lt=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=so(t,"DataView"),jn=so(t,"Map"),Pn=so(t,"Promise"),Sn=so(t,"Set"),An=so(t,"WeakMap"),xn=so(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,s=1&t,l=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!s)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,s);if(p==P||p==d||h&&!o){if(u=l||h?{}:ho(e),!s)return l?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,lo(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,s)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?l?to:eo:l?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function sr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function lr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,s=[],l=t.length;if(!u)return s;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,s=u,l=r(u),c=1/0,f=[];s--;){var p=e[s];s&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),l[s]=!n&&(t||a>=120&&p.length>=120)?new Gn(s&&p):i}p=e[0];var h=-1,b=l[0];e:for(;++h=u?s:s*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,s,1),Ke.call(e,s,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):si(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,ns),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,s=e;null!=s&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var l=t?null:Gi(e);if(l)return sn(l);a=!1,i=Zt,s=new Gn}else s=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,s=null===t,l=t==t,c=uu(t);if(!s&&!c&&!a&&e>t||a&&u&&l&&!s&&!c||r&&u&&l||!n&&l||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!s&&"wrapper"==ro(u))var s=new Fn([],!0)}for(r=s?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof l&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?ts))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=lt||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,l,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=s}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=s}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,s,l,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,s=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);l=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return l=i,b&&r?d(e):(r=a=i,s)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(l===i)return function(e){return f=e,l=Eo(y,t),p?d(e):s}(c);if(h)return _i(l),l=Eo(y,t),d(c)}return l===i&&(l=Eo(y,t)),s}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){l!==i&&_i(l),f=0,r=c=a=l=i},_.flush=function(){return l===i?s:g(Sa())},_}var Ia=Kr((function(e,t){return sr(e,1,t)})),ka=Kr((function(e,t,n){return sr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||ds,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var su=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},lu=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?sn:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?st(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)si(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(se)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var es=Ri(),ts=Ri(!0);function ns(e){return e}function rs(e){return Nr("function"==typeof e?e:ar(e,1))}var is=Kr((function(e,t){return function(n){return Er(n,e,t)}})),os=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function as(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function us(){}var ss=Bi(It),ls=Bi(xt),cs=Bi(Dt);function fs(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var ps=Ui(),hs=Ui(!0);function bs(){return[]}function ds(){return!1}var vs,ys=zi((function(e,t){return e+t}),0),gs=Hi("ceil"),_s=zi((function(e,t){return e/t}),1),ms=Hi("floor"),ws=zi((function(e,t){return e*t}),1),Os=Hi("round"),js=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,s=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||su(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||si(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:li(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:li(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=sa,Ln.zip=la,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,as(Ln,Ln),Ln.add=ys,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gs,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_s,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ms,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=ns,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=su,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=lu,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,ns,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,ns)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,ns,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bs,Ln.stubFalse=ds,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=ws,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=us,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var s=n-cn(r);if(s<1)return r;var l=u?gi(u,0,s).join(""):e.slice(0,s);if(o===i)return l+r;if(u&&(s+=l.length-s),iu(o)){if(e.slice(s).search(o)){var c,f=l;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;l=l.slice(0,p===i?s:p)}}else if(e.indexOf(ai(o),s)!=s){var h=l.lastIndexOf(o);h>-1&&(l=l.slice(0,h))}return l+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,as(Ln,(vs={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vs[t]=e)})),vs),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(ns)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,s=t instanceof Un,l=u[0],c=s||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof l&&1!=l.length&&(s=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=s&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,s=a&&u&&"object"==typeof n.g&&n.g;!s||s.global!==s&&s.window!==s&&s.self!==s||(o=s);var l=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=l)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(l=n)?typeof l[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!l[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),s=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!s?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!s?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var s=t[o];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=n[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)lt(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,s=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var l=Vt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(s,l);e.then(c,n)}e=n,s(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function sn(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=l),an(this)){var o=sn(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return l;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=sn(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!sn(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=ln(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=ln(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=ln(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return lr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return lr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var s=r.value;if(!i.has(s))if(n.delete(s))a=!0;else{var l=n.data_.get(s);o.set(s,l)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!sn(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=ln(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!sn(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=ln(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return lr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=sr(e),t=sr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function sr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function lr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var s=a._childNodes[a.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw li(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var s,l,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(s=r.onError,l=n,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw li(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],si));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw li("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(r),s=!0)}s&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw li(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw li(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw li("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw li("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function lo(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new so(e,t,n||co)}var co=[void 0],fo=lo(eo,void 0),po=lo(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw li("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):lo(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Execute a simple snapshot listener",(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,t=No.model({string:No.string,number:No.number,integer:No.integer,float:No.float,boolean:No.boolean,date:No.Date}).actions((e=>({changeString:t=>{e.string=t}}))).create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date});var n,r,i,o;r=e=>e,Qr(n=t),ei(n).onSnapshot(r),t.changeString("newString"),i="Execute a simple snapshot listener",o=(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed)-e,Ro[i]?Ro[i]=Math.max(Ro[i],o):Ro[i]=o})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/execute-a-simple-snapshot-listener-web-bundle.js.LICENSE.txt b/build/execute-a-simple-snapshot-listener-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/execute-a-simple-snapshot-listener-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/get-a-snapshot-of-a-model-bundle-source.js b/build/get-a-snapshot-of-a-model-bundle-source.js new file mode 100644 index 0000000..f83fa1f --- /dev/null +++ b/build/get-a-snapshot-of-a-model-bundle-source.js @@ -0,0 +1,104 @@ + +import { types, getSnapshot } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Get a snapshot of a model", () => { + const startMemory = getStartMemory(); + const Model = types.model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, +}); + +const m = Model.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), +}); + +const snapshot = getSnapshot(m); +return snapshot; + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Get a snapshot of a model", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/get-a-snapshot-of-a-model-node-bundle.js b/build/get-a-snapshot-of-a-model-node-bundle.js new file mode 100644 index 0000000..6607574 --- /dev/null +++ b/build/get-a-snapshot-of-a-model-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see get-a-snapshot-of-a-model-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Xe(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Je(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(X(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Vt(e){return v(e)&&!0===e.isMobxAction}function Ct(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Vr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Vr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Xt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Vr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Jt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Vr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Jt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Ct((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Vr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Vr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},C(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Vr=P("ObservableMap",Nr),Cr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Cr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Vr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Xt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Vr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Xn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Jn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Vi?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Vi&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Cn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Vn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Xt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Cn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Vn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Jn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Jn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Jn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Va=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Ca={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Ci(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Get a snapshot of a model",(()=>(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,_n(Ca.model({string:Ca.string,number:Ca.number,integer:Ca.integer,float:Ca.float,boolean:Ca.boolean,date:Ca.Date}).create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}))))),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/get-a-snapshot-of-a-model-node-bundle.js.LICENSE.txt b/build/get-a-snapshot-of-a-model-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/get-a-snapshot-of-a-model-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/get-a-snapshot-of-a-model-web-bundle.js b/build/get-a-snapshot-of-a-model-web-bundle.js new file mode 100644 index 0000000..c890e9e --- /dev/null +++ b/build/get-a-snapshot-of-a-model-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see get-a-snapshot-of-a-model-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw si("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw si(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw si("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw si("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw si("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw si(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw si("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw si("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw si("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw si("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw si("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw si(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw si(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw si("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw si("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw si("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw si("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw si("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw si("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function so(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw si("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||co)}var co=[void 0],fo=so(eo,void 0),po=so(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw si("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw si("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw si("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw si("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw si("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw si("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):so(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Get a snapshot of a model",(()=>(void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed,mr(No.model({string:No.string,number:No.number,integer:No.integer,float:No.float,boolean:No.boolean,date:No.Date}).create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}))))),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/get-a-snapshot-of-a-model-web-bundle.js.LICENSE.txt b/build/get-a-snapshot-of-a-model-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/get-a-snapshot-of-a-model-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/get-a-view-with-a-parameter-bundle-source.js b/build/get-a-view-with-a-parameter-bundle-source.js new file mode 100644 index 0000000..30f6558 --- /dev/null +++ b/build/get-a-view-with-a-parameter-bundle-source.js @@ -0,0 +1,112 @@ + +import { types } from "mobx-state-tree"; +k; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Get a view with a parameter", () => { + const startMemory = getStartMemory(); + const User = types.model({ + id: types.identifier, + name: types.string, + age: types.number, +}); + +const UserStore = types + .model({ + users: types.array(User), + }) + .views((self) => ({ + get numberOfChildren() { + return self.users.filter((user) => user.age < 18).length; + }, + numberOfPeopleOlderThan(age) { + return self.users.filter((user) => user.age > age).length; + }, + })); + +const userStore = UserStore.create({ + users: [ + { id: "1", name: "John", age: 42 }, + { id: "2", name: "Jane", age: 47 }, + ], +}); + +return userStore.numberOfPeopleOlderThan(50); + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Get a view with a parameter", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/get-a-view-with-a-parameter-node-bundle.js b/build/get-a-view-with-a-parameter-node-bundle.js new file mode 100644 index 0000000..1c200dd --- /dev/null +++ b/build/get-a-view-with-a-parameter-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see get-a-view-with-a-parameter-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var U=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,r){F(t,r,e)}),e)}function F(e,t,r){I(e,U)||w(e,U,x({},e[U])),function(e){return e.annotationType_===$}(r)||(e[U][t]=r)}var H=Symbol("mobx administration"),G=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ke.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=st.inBatch?st.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){st.inBatch&&this.batchId_===st.batchId||(st.stateVersion=st.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&&ct(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,lt(l,e))}n!==Ke.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),it(n),i}function Qe(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)ct(t[r],e);e.dependenciesState_=Ke.NOT_TRACKING_}function et(e){var t=tt();try{return e()}finally{rt(t)}}function tt(){var e=st.trackingDerivation;return st.trackingDerivation=null,e}function rt(e){st.trackingDerivation=e}function nt(e){var t=st.allowStateReads;return st.allowStateReads=e,t}function it(e){st.allowStateReads=e}function at(e){if(e.dependenciesState_!==Ke.UP_TO_DATE_){e.dependenciesState_=Ke.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ke.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ut=!0,st=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ut=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new ot).version&&(ut=!1),ut?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new ot):(setTimeout((function(){r(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function ct(e,t){e.observers_.delete(t),0===e.observers_.size&&ft(e)}function ft(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,st.pendingUnobservations.push(e))}function pt(){0===st.inBatch&&(st.batchId=st.batchId0&&ft(e),!1)}function dt(e){e.lowestObserverState_!==Ke.STALE_&&(e.lowestObserverState_=Ke.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ke.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ke.STALE_})))}var vt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ke.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=We.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,st.pendingReactions.push(this),mt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){pt(),this.isScheduled_=!1;var e=st.trackingContext;if(st.trackingContext=this,Xe(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}st.trackingContext=e,bt()}},t.track=function(e){if(!this.isDisposed_){pt(),this.isRunning_=!0;var t=st.trackingContext;st.trackingContext=this;var r=Ze(this,e,void 0);st.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Qe(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),bt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(st.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";st.suppressReactionErrors||console.error(r,e),st.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(pt(),Qe(this),bt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[H]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),yt=100,gt=function(e){return e()};function mt(){st.inBatch>0||st.isRunningReactions||gt(_t)}function _t(){st.isRunningReactions=!0;for(var e=st.pendingReactions,t=0;e.length>0;){++t===yt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Le(t,r,e):y(r)?F(t,r,e?At:jt):y(t)?B(X(e?Pt:Ot,{name:t,autoAction:e})):void 0}}var It=Tt(!1);Object.assign(It,jt);var Nt=Tt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function Vt(e){return v(e)&&!0===e.isMobxAction}function xt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new vt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new vt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(Nt,At),It.bound=B(St),Nt.bound=B(Et);var kt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:kt}var Rt="onBO",Lt="onBUO";function Mt(e,t,r){return zt(Lt,e,t,r)}function zt(e,t,r,n){var i="function"==typeof n?tn(t,r):tn(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var Ut=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=te("flow"),Ht=te("flow.bound",{bound:!0}),Gt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++Ut,a=It(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=It(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=It(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=It(n+" - runid: "+i+" - cancel",(function(){try{o&&Kt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Kt(r),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function Kt(e){v(e.cancel)&&e.cancel()}function Wt(e){return!0===(null==e?void 0:e.isMobXFlow)}function qt(e,t,r){var n;return Vr(e)||Sr(e)||Ge(e)?n=rn(e):Fr(e)&&(n=rn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function Yt(e,t,r){return v(r)?function(e,t,r){return rn(e,t).intercept_(r)}(e,t,r):function(e,t){return rn(e).intercept_(t)}(e,t)}function Jt(e){return function(e,t){return!!e&&(void 0!==t?!!Fr(e)&&e[H].values_.has(t):Fr(e)||!!e[H]||K(e)||wt(e)||Ye(e))}(e)}function $t(e){return Fr(e)?e[H].keys_():Vr(e)||Dr(e)?Array.from(e.keys()):Sr(e)?e.map((function(e,t){return t})):void r(5)}function Xt(e){return Fr(e)?$t(e).map((function(t){return e[t]})):Vr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):Sr(e)?e.slice():void r(6)}function Zt(e,t,n){if(2!==arguments.length||Dr(e))Fr(e)?e[H].set_(t,n):Vr(e)?e.set(t,n):Dr(e)?e.add(t):Sr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),pt(),t>=e.length&&(e.length=t+1),e[t]=n,bt()):r(8);else{pt();var i=t;try{for(var a in i)Zt(e,a,i[a])}finally{bt()}}}function Qt(e,t,n){if(Fr(e))return e[H].defineProperty_(t,n);r(39)}function er(e,t,r,n){return v(r)?function(e,t,r,n){return rn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return rn(e).observe_(t,r)}(e,t,r)}function tr(e,t){void 0===t&&(t=void 0),pt();try{return e.apply(t)}finally{bt()}}function rr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=nr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):nr(e,t,r||{})}function nr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[H].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Le("When-effect",t),o=xt((function(t){ze(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function ir(e){return e[H]}Gt.bound=B(Ht);var ar={has:function(e,t){return ir(e).has_(t)},get:function(e,t){return ir(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=ir(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=ir(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=ir(e).defineProperty_(t,r))||n},ownKeys:function(e){return ir(e).ownKeys_()},preventExtensions:function(e){r(13)}};function or(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function ur(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function sr(e,t){var n=tt();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function cr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function fr(e,t){var r=tt(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return ur(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Qr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),or(this)){var a=sr(this,{object:this.proxy_,type:pr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function gr(e,t){"function"==typeof Array.prototype[e]&&(yr[e]=t(e))}function mr(e){return function(){var t=this[H];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function _r(e){return function(t,r){var n=this,i=this[H];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function wr(e){return function(){var t=this,r=this[H];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}gr("concat",mr),gr("flat",mr),gr("includes",mr),gr("indexOf",mr),gr("join",mr),gr("lastIndexOf",mr),gr("slice",mr),gr("toString",mr),gr("toLocaleString",mr),gr("every",_r),gr("filter",_r),gr("find",_r),gr("findIndex",_r),gr("flatMap",_r),gr("forEach",_r),gr("map",_r),gr("some",_r),gr("reduce",wr),gr("reduceRight",wr);var Or,Pr,jr=P("ObservableArrayAdministration",dr);function Sr(e){return g(e)&&jr(e[H])}var Ar={},Er="add",Tr="delete";Or=Symbol.iterator,Pr=Symbol.toStringTag;var Ir,Nr,Cr=function(){function e(e,t,n){var i=this;void 0===t&&(t=Y),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[H]=Ar,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),an((function(){i.keysAtom_=W("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!st.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new He(this.has_(e),J,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Mt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(or(this)){var n=sr(this,{type:r?br:Er,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,or(this)&&!sr(this,{type:Tr,object:this,name:e}))return!1;if(this.has_(e)){var r=lr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Tr,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return tr((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&fr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==st.UNCHANGED){var n=lr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:br,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&fr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,tr((function(){var n,i=new He(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=lr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,name:e,newValue:t}:null;n&&fr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return cn({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return cn({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[Or]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=z(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Vr(e)&&(e=new Map(e)),tr((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;tr((function(){et((function(){for(var t,r=z(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return tr((function(){for(var n,i=function(e){if(j(e)||Vr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=z(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=z(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return cr(this,e)},t.intercept_=function(e){return ur(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Pr,get:function(){return"Map"}}]),e}(),Vr=P("ObservableMap",Cr),xr={};Ir=Symbol.iterator,Nr=Symbol.toStringTag;var kr=function(){function e(e,t,n){var i=this;void 0===t&&(t=Y),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[H]=xr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},an((function(){i.atom_=W(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;tr((function(){et((function(){for(var t,r=z(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=z(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,or(this)&&!sr(this,{type:Er,object:this,newValue:e}))return this;if(!this.has(e)){tr((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=lr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,newValue:e}:null;r&&fr(this,n)}return this},t.delete=function(e){var t=this;if(or(this)&&!sr(this,{type:Tr,object:this,oldValue:e}))return!1;if(this.has(e)){var r=lr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Tr,object:this,oldValue:e}:null;return tr((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&fr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return cn({next:function(){var n=e;return e+=1,nYr){for(var t=Yr;t=0&&r++}e=ln(e),t=ln(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!sn(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!sn(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function ln(e){return Sr(e)?e.slice():j(e)||Vr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function cn(e){return e[Symbol.iterator]=fn,e}function fn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:nn},$mobx:H});var pn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(pn||(pn={}));var bn=function(e,t){return bn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},bn(e,t)};function hn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}bn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var dn=function(){return dn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function yn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function gn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Yn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Pn);jn.prototype.die=It(jn.prototype.die);var Sn,An,En=1,Tn={onError:function(e){throw e}},In=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++En}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ce((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw ci("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Na(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return hn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=vn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Yn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=si,this.state=Yn.CREATED,e){this.fireHook(pn.afterCreate),this.finalizeCreation();try{for(var c=vn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(pn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(pn.beforeDetach);var e=this.state;this.state=Yn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(pn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Ct?Ct((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw ci(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ti(e.subpath)||"",n=e.actionContext||Ln;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(ei(i=n.context,1),ti(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(si),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ai(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw ci("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=vn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(pn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw ci("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=zn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ii);if(!(""===e||"."===e||".."===e||Pi(e,"/")||Pi(e,"./")||Pi(e,"../")))throw ci("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ii(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=zn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),mi(this.storedValue,"$treenode",this),mi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Yn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=It(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?q.structural:n.equals||q.default,_=new vt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=ze(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),Tn);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new wi),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Ln,Mn=1;function zn(e,t,r){var n=function(){var n=Mn++,i=Ln,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ti(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Ln;Ln=e;try{return function(e,t,r){var n=new Un(e,r);if(n.isEmpty)return It(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&pn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):It(r).apply(null,t.args)}(t)}(r,e,t)}finally{Ln=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:Oi(arguments),context:e,tree:On(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?gn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var Un=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Bn(e){return"function"==typeof e?"":Qn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Qn(t)?"value of type "+ti(t).type.name+":":yi(t)?"value":"snapshot",o=r&&Qn(t)&&r.is(ti(t).snapshot);return""+i+a+" "+Bn(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(An.String|An.Number|An.Integer|An.Boolean|An.Date))>0}(r)||yi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Hn(e,t,r){return e.concat([{path:t,type:r}])}function Gn(){return ui}function Kn(e,t,r){return[{context:e,value:t,message:r}]}function Wn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function qn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw ci(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Bn(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Fn).join("\n ")}(e,t,r))}(e,t)}var Yn,Jn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Jn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ee.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ee.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ee.array([],li));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw ci("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Xt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Fr(n)?$t(n).map((function(e){return[e,n[e]]})):Vr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):Sr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=yn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw ci("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Xn(e,t,r,n,i){var a=ri(i);if(a){if(a.parent)throw ci("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new In(e,t,r,n,i)}function Zn(e,t,r,n,i){return new jn(e,t,r,n,i)}function Qn(e){return!(!e||!e.$treenode)}function ei(e,t){ji()}function ti(e){if(!Qn(e))throw ci("Value "+e+" is no MST Node");return e.$treenode}function ri(e){return e&&e.$treenode||null}function ni(){return ti(this).snapshot}function ii(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Qn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Qn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Vi?Kn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Qn(e)?wn(e,!1):this.preProcessSnapshotSafe(e);return t!==Vi&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof xn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Vn),ki="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===Nn)return!1;if(i){var a=hi(i);try{for(var o=vn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Wi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Ri=function(e){function t(t,r){return e.call(this,t,Ee.ref.enhancer,r)||this}return hn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw ci("Map.put cannot be used to set empty values");if(Qn(e)){var t=ti(e);if(null===t.identifier)throw ci(ki);return this.set(t.identifier,e),e}if(vi(e)){var r=ti(this),n=r.type;if(n.identifierMode!==Ci.YES)throw ci(ki);var i=e[n.mapIdentifierAttribute];if(!Ca(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(wn(a))}var o=Na(i);return this.set(o,e),this.get(o)}throw ci("Map.put can only be used to store complex values")}}),t}(Cr),Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return hn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw ci("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Ri(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){qt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=zn(t,e,n);mi(t,e,i)}))})),Yt(t,this.willChange),er(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Xt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw ci("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ti(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;qn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":qn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof In){var r=t.identifier;if(r!==e)throw ci("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ti(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ti(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ti(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ti(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){qn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return di(e)?Wn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Hn(t,n,r._subType))}))):Kn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return si}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(xn);Li.prototype.applySnapshot=It(Li.prototype.applySnapshot);var Mi=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return hn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=dn(dn({},li),{name:this.name});return Ee.array(ai(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){rn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=zn(t,e,n);mi(t,e,i)}))})),Yt(t,this.willChange),er(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Qn(e)?ti(e).snapshot:e;return this._predicate(n)?Gn():Kn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn),ua=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=dn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return hn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=An.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw ci("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw ci("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&qn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Gn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn);function ca(e,t,r){return function(e,t){if("function"!=typeof t&&Qn(t))throw ci("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Rn()}(0,t),new la(e,t,r||fa)}var fa=[void 0],pa=ca(ta,void 0),ba=ca(ea,null);function ha(e){return Rn(),sa(e,pa)}var da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return hn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|An.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw ci("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Gn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Nn}}),t}(Vn),va=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ee.array()}),rr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(It((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return hn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Zn(this,e,t,r,n);return this.pendingNodeList.push(a),rr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):gi(e)?Gn():Kn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(kn),ya=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Frozen}),r}return hn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Zn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return gi(e)?this.subType?this.subType.validate(e,t):Gn():Kn(t,e,"Value is not serializable and cannot be frozen")}}),t}(kn),ga=new ya,ma=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Ca(e))this.identifier=e;else{if(!Qn(e))throw ci("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ti(e);if(!r.identifierAttribute)throw ci("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw ci("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Na(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new _a("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),_a=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return hn(t,e),t}(Error),wa=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Reference}),n}return hn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Ca(e)?Gn():Kn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){_n(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&An.Object)>0?this.replaceRef(void 0):_n(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ti(n),a=function(n,a){var o=function(e){switch(e){case pn.beforeDestroy:return"destroy";case pn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(pn.beforeDetach,a),u=i.registerHook(pn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(pn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Na(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Yn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(pn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(pn.afterAttach,(function(){a(!1)})))}}}),t}(kn),Oa=function(e){function t(t,r){return e.call(this,t,r)||this}return hn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Qn(n)?(ei(i=n),ti(i).identifier):n,o=new ma(n,this.targetType),u=Zn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Qn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(wa),Pa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return hn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Qn(n)?this.options.set(n,e?e.storedValue:null):n,a=Zn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Qn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(wa);function ja(e,t){Rn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Pa(e,{get:r.get,set:r.set},n):new Oa(e,n)}var Sa=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Identifier}),n}return hn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Wi))throw ci("Identifier types can only be instantiated as direct child of a model type");return Zn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw ci("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Kn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Gn()}}),t}(kn),Aa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Identifier}),t}return hn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(Sa),Ea=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(Sa),Ta=new Aa,Ia=new Ea;function Na(e){return""+e}function Ca(e){return"string"==typeof e||"number"==typeof e}var Va=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Custom}),r}return hn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Gn();var r=this.options.getValidationMessage(e);return r?Kn(t,e,"Invalid value for type '"+this.name+"': "+r):Gn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Zn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(kn),xa={enumeration:function(e,t){var r="string"==typeof e?t:e,n=sa.apply(void 0,gn(r.map((function(e){return aa(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Rn(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ga:Dn(e)?new ya(e):ca(ga,e)},identifier:Ta,identifierNumber:Ia,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new da(r,"string"==typeof e?t:e)},lazy:function(e,t){return new va(e,t)},undefined:ta,null:ea,snapshotProcessor:function(e,t,r){return Rn(),new xi(e,t,r)}};const ka=require("benchmark");k;var Da=new(e.n(ka)().Suite);const Ra={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ra[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Get a view with a parameter",(()=>{void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;const e=xa.model({id:xa.identifier,name:xa.string,age:xa.number});return xa.model({users:xa.array(e)}).views((e=>({get numberOfChildren(){return e.users.filter((e=>e.age<18)).length},numberOfPeopleOlderThan:t=>e.users.filter((e=>e.age>t)).length}))).create({users:[{id:"1",name:"John",age:42},{id:"2",name:"Jane",age:47}]}).numberOfPeopleOlderThan(50)})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/get-a-view-with-a-parameter-node-bundle.js.LICENSE.txt b/build/get-a-view-with-a-parameter-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/get-a-view-with-a-parameter-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/get-a-view-with-a-parameter-twice-should-not-be-cached-bundle-source.js b/build/get-a-view-with-a-parameter-twice-should-not-be-cached-bundle-source.js new file mode 100644 index 0000000..b1f2e2b --- /dev/null +++ b/build/get-a-view-with-a-parameter-twice-should-not-be-cached-bundle-source.js @@ -0,0 +1,114 @@ + +import { types } from "mobx-state-tree"; +k; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Get a view with a parameter twice (should not be cached)", () => { + const startMemory = getStartMemory(); + const User = types.model({ + id: types.identifier, + name: types.string, + age: types.number, +}); + +const UserStore = types + .model({ + users: types.array(User), + }) + .views((self) => ({ + get numberOfChildren() { + return self.users.filter((user) => user.age < 18).length; + }, + numberOfPeopleOlderThan(age) { + return self.users.filter((user) => user.age > age).length; + }, + })); + +const userStore = UserStore.create({ + users: [ + { id: "1", name: "John", age: 42 }, + { id: "2", name: "Jane", age: 47 }, + ], +}); + +const numberOfPeopleOlderThan = userStore.numberOfPeopleOlderThan(50); +const numberOfPeopleOlderThanAgain = userStore.numberOfPeopleOlderThan(50); +return numberOfPeopleOlderThanAgain; + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Get a view with a parameter twice (should not be cached)", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/get-a-view-with-a-parameter-twice-should-not-be-cached-node-bundle.js b/build/get-a-view-with-a-parameter-twice-should-not-be-cached-node-bundle.js new file mode 100644 index 0000000..aa65057 --- /dev/null +++ b/build/get-a-view-with-a-parameter-twice-should-not-be-cached-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see get-a-view-with-a-parameter-twice-should-not-be-cached-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var U=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,r){F(t,r,e)}),e)}function F(e,t,r){I(e,U)||w(e,U,x({},e[U])),function(e){return e.annotationType_===$}(r)||(e[U][t]=r)}var H=Symbol("mobx administration"),G=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ke.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=st.inBatch?st.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){st.inBatch&&this.batchId_===st.batchId||(st.stateVersion=st.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&&ct(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,lt(l,e))}n!==Ke.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),it(n),i}function Qe(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)ct(t[r],e);e.dependenciesState_=Ke.NOT_TRACKING_}function et(e){var t=tt();try{return e()}finally{rt(t)}}function tt(){var e=st.trackingDerivation;return st.trackingDerivation=null,e}function rt(e){st.trackingDerivation=e}function nt(e){var t=st.allowStateReads;return st.allowStateReads=e,t}function it(e){st.allowStateReads=e}function at(e){if(e.dependenciesState_!==Ke.UP_TO_DATE_){e.dependenciesState_=Ke.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ke.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ut=!0,st=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ut=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new ot).version&&(ut=!1),ut?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new ot):(setTimeout((function(){r(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function ct(e,t){e.observers_.delete(t),0===e.observers_.size&&ft(e)}function ft(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,st.pendingUnobservations.push(e))}function pt(){0===st.inBatch&&(st.batchId=st.batchId0&&ft(e),!1)}function dt(e){e.lowestObserverState_!==Ke.STALE_&&(e.lowestObserverState_=Ke.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ke.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ke.STALE_})))}var vt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ke.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=We.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,st.pendingReactions.push(this),mt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){pt(),this.isScheduled_=!1;var e=st.trackingContext;if(st.trackingContext=this,Xe(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}st.trackingContext=e,bt()}},t.track=function(e){if(!this.isDisposed_){pt(),this.isRunning_=!0;var t=st.trackingContext;st.trackingContext=this;var r=Ze(this,e,void 0);st.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Qe(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),bt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(st.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";st.suppressReactionErrors||console.error(r,e),st.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(pt(),Qe(this),bt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[H]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),yt=100,gt=function(e){return e()};function mt(){st.inBatch>0||st.isRunningReactions||gt(_t)}function _t(){st.isRunningReactions=!0;for(var e=st.pendingReactions,t=0;e.length>0;){++t===yt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Le(t,r,e):y(r)?F(t,r,e?At:jt):y(t)?B(X(e?Pt:Ot,{name:t,autoAction:e})):void 0}}var It=Tt(!1);Object.assign(It,jt);var Nt=Tt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function Vt(e){return v(e)&&!0===e.isMobxAction}function xt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new vt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new vt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(Nt,At),It.bound=B(St),Nt.bound=B(Et);var kt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:kt}var Rt="onBO",Lt="onBUO";function Mt(e,t,r){return zt(Lt,e,t,r)}function zt(e,t,r,n){var i="function"==typeof n?tn(t,r):tn(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var Ut=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=te("flow"),Ht=te("flow.bound",{bound:!0}),Gt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++Ut,a=It(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=It(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=It(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=It(n+" - runid: "+i+" - cancel",(function(){try{o&&Kt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Kt(r),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function Kt(e){v(e.cancel)&&e.cancel()}function Wt(e){return!0===(null==e?void 0:e.isMobXFlow)}function qt(e,t,r){var n;return Vr(e)||Sr(e)||Ge(e)?n=rn(e):Fr(e)&&(n=rn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function Yt(e,t,r){return v(r)?function(e,t,r){return rn(e,t).intercept_(r)}(e,t,r):function(e,t){return rn(e).intercept_(t)}(e,t)}function Jt(e){return function(e,t){return!!e&&(void 0!==t?!!Fr(e)&&e[H].values_.has(t):Fr(e)||!!e[H]||K(e)||wt(e)||Ye(e))}(e)}function $t(e){return Fr(e)?e[H].keys_():Vr(e)||Dr(e)?Array.from(e.keys()):Sr(e)?e.map((function(e,t){return t})):void r(5)}function Xt(e){return Fr(e)?$t(e).map((function(t){return e[t]})):Vr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):Sr(e)?e.slice():void r(6)}function Zt(e,t,n){if(2!==arguments.length||Dr(e))Fr(e)?e[H].set_(t,n):Vr(e)?e.set(t,n):Dr(e)?e.add(t):Sr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),pt(),t>=e.length&&(e.length=t+1),e[t]=n,bt()):r(8);else{pt();var i=t;try{for(var a in i)Zt(e,a,i[a])}finally{bt()}}}function Qt(e,t,n){if(Fr(e))return e[H].defineProperty_(t,n);r(39)}function er(e,t,r,n){return v(r)?function(e,t,r,n){return rn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return rn(e).observe_(t,r)}(e,t,r)}function tr(e,t){void 0===t&&(t=void 0),pt();try{return e.apply(t)}finally{bt()}}function rr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=nr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):nr(e,t,r||{})}function nr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[H].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Le("When-effect",t),o=xt((function(t){ze(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function ir(e){return e[H]}Gt.bound=B(Ht);var ar={has:function(e,t){return ir(e).has_(t)},get:function(e,t){return ir(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=ir(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=ir(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=ir(e).defineProperty_(t,r))||n},ownKeys:function(e){return ir(e).ownKeys_()},preventExtensions:function(e){r(13)}};function or(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function ur(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function sr(e,t){var n=tt();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function cr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function fr(e,t){var r=tt(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return ur(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Qr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),or(this)){var a=sr(this,{object:this.proxy_,type:pr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function gr(e,t){"function"==typeof Array.prototype[e]&&(yr[e]=t(e))}function mr(e){return function(){var t=this[H];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function _r(e){return function(t,r){var n=this,i=this[H];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function wr(e){return function(){var t=this,r=this[H];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}gr("concat",mr),gr("flat",mr),gr("includes",mr),gr("indexOf",mr),gr("join",mr),gr("lastIndexOf",mr),gr("slice",mr),gr("toString",mr),gr("toLocaleString",mr),gr("every",_r),gr("filter",_r),gr("find",_r),gr("findIndex",_r),gr("flatMap",_r),gr("forEach",_r),gr("map",_r),gr("some",_r),gr("reduce",wr),gr("reduceRight",wr);var Or,Pr,jr=P("ObservableArrayAdministration",dr);function Sr(e){return g(e)&&jr(e[H])}var Ar={},Er="add",Tr="delete";Or=Symbol.iterator,Pr=Symbol.toStringTag;var Ir,Nr,Cr=function(){function e(e,t,n){var i=this;void 0===t&&(t=Y),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[H]=Ar,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),an((function(){i.keysAtom_=W("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!st.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new He(this.has_(e),J,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Mt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(or(this)){var n=sr(this,{type:r?br:Er,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,or(this)&&!sr(this,{type:Tr,object:this,name:e}))return!1;if(this.has_(e)){var r=lr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Tr,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return tr((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&fr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==st.UNCHANGED){var n=lr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:br,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&fr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,tr((function(){var n,i=new He(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=lr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,name:e,newValue:t}:null;n&&fr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return cn({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return cn({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[Or]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=z(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Vr(e)&&(e=new Map(e)),tr((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;tr((function(){et((function(){for(var t,r=z(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return tr((function(){for(var n,i=function(e){if(j(e)||Vr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=z(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=z(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return cr(this,e)},t.intercept_=function(e){return ur(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Pr,get:function(){return"Map"}}]),e}(),Vr=P("ObservableMap",Cr),xr={};Ir=Symbol.iterator,Nr=Symbol.toStringTag;var kr=function(){function e(e,t,n){var i=this;void 0===t&&(t=Y),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[H]=xr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},an((function(){i.atom_=W(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;tr((function(){et((function(){for(var t,r=z(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=z(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,or(this)&&!sr(this,{type:Er,object:this,newValue:e}))return this;if(!this.has(e)){tr((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=lr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,newValue:e}:null;r&&fr(this,n)}return this},t.delete=function(e){var t=this;if(or(this)&&!sr(this,{type:Tr,object:this,oldValue:e}))return!1;if(this.has(e)){var r=lr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Tr,object:this,oldValue:e}:null;return tr((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&fr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return cn({next:function(){var n=e;return e+=1,nYr){for(var t=Yr;t=0&&r++}e=ln(e),t=ln(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!sn(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!sn(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function ln(e){return Sr(e)?e.slice():j(e)||Vr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function cn(e){return e[Symbol.iterator]=fn,e}function fn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:nn},$mobx:H});var pn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(pn||(pn={}));var bn=function(e,t){return bn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},bn(e,t)};function hn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}bn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var dn=function(){return dn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function yn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function gn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Yn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Pn);jn.prototype.die=It(jn.prototype.die);var Sn,An,En=1,Tn={onError:function(e){throw e}},In=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++En}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ce((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw ci("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Na(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return hn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=vn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Yn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=si,this.state=Yn.CREATED,e){this.fireHook(pn.afterCreate),this.finalizeCreation();try{for(var c=vn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(pn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(pn.beforeDetach);var e=this.state;this.state=Yn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(pn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Ct?Ct((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw ci(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ti(e.subpath)||"",n=e.actionContext||Ln;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(ei(i=n.context,1),ti(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(si),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ai(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw ci("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=vn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(pn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw ci("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=zn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ii);if(!(""===e||"."===e||".."===e||Pi(e,"/")||Pi(e,"./")||Pi(e,"../")))throw ci("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ii(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=zn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),mi(this.storedValue,"$treenode",this),mi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Yn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=It(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?q.structural:n.equals||q.default,_=new vt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=ze(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),Tn);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new wi),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Ln,Mn=1;function zn(e,t,r){var n=function(){var n=Mn++,i=Ln,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ti(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Ln;Ln=e;try{return function(e,t,r){var n=new Un(e,r);if(n.isEmpty)return It(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&pn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):It(r).apply(null,t.args)}(t)}(r,e,t)}finally{Ln=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:Oi(arguments),context:e,tree:On(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?gn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var Un=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Bn(e){return"function"==typeof e?"":Qn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Qn(t)?"value of type "+ti(t).type.name+":":yi(t)?"value":"snapshot",o=r&&Qn(t)&&r.is(ti(t).snapshot);return""+i+a+" "+Bn(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(An.String|An.Number|An.Integer|An.Boolean|An.Date))>0}(r)||yi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Hn(e,t,r){return e.concat([{path:t,type:r}])}function Gn(){return ui}function Kn(e,t,r){return[{context:e,value:t,message:r}]}function Wn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function qn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw ci(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Bn(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Fn).join("\n ")}(e,t,r))}(e,t)}var Yn,Jn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Jn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ee.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ee.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ee.array([],li));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw ci("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Xt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Fr(n)?$t(n).map((function(e){return[e,n[e]]})):Vr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):Sr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=yn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw ci("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Xn(e,t,r,n,i){var a=ri(i);if(a){if(a.parent)throw ci("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new In(e,t,r,n,i)}function Zn(e,t,r,n,i){return new jn(e,t,r,n,i)}function Qn(e){return!(!e||!e.$treenode)}function ei(e,t){ji()}function ti(e){if(!Qn(e))throw ci("Value "+e+" is no MST Node");return e.$treenode}function ri(e){return e&&e.$treenode||null}function ni(){return ti(this).snapshot}function ii(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Qn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Qn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Vi?Kn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Qn(e)?wn(e,!1):this.preProcessSnapshotSafe(e);return t!==Vi&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof xn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Vn),ki="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===Nn)return!1;if(i){var a=hi(i);try{for(var o=vn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Wi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Ri=function(e){function t(t,r){return e.call(this,t,Ee.ref.enhancer,r)||this}return hn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw ci("Map.put cannot be used to set empty values");if(Qn(e)){var t=ti(e);if(null===t.identifier)throw ci(ki);return this.set(t.identifier,e),e}if(vi(e)){var r=ti(this),n=r.type;if(n.identifierMode!==Ci.YES)throw ci(ki);var i=e[n.mapIdentifierAttribute];if(!Ca(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(wn(a))}var o=Na(i);return this.set(o,e),this.get(o)}throw ci("Map.put can only be used to store complex values")}}),t}(Cr),Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return hn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw ci("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Ri(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){qt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=zn(t,e,n);mi(t,e,i)}))})),Yt(t,this.willChange),er(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Xt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw ci("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ti(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;qn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":qn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof In){var r=t.identifier;if(r!==e)throw ci("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ti(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ti(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ti(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ti(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){qn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return di(e)?Wn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Hn(t,n,r._subType))}))):Kn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return si}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(xn);Li.prototype.applySnapshot=It(Li.prototype.applySnapshot);var Mi=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return hn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=dn(dn({},li),{name:this.name});return Ee.array(ai(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){rn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=zn(t,e,n);mi(t,e,i)}))})),Yt(t,this.willChange),er(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Qn(e)?ti(e).snapshot:e;return this._predicate(n)?Gn():Kn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn),ua=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=dn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return hn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=An.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw ci("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw ci("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&qn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Gn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vn);function ca(e,t,r){return function(e,t){if("function"!=typeof t&&Qn(t))throw ci("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Rn()}(0,t),new la(e,t,r||fa)}var fa=[void 0],pa=ca(ta,void 0),ba=ca(ea,null);function ha(e){return Rn(),sa(e,pa)}var da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return hn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|An.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw ci("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Gn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Nn}}),t}(Vn),va=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ee.array()}),rr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(It((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return hn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Zn(this,e,t,r,n);return this.pendingNodeList.push(a),rr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):gi(e)?Gn():Kn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(kn),ya=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Frozen}),r}return hn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Zn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return gi(e)?this.subType?this.subType.validate(e,t):Gn():Kn(t,e,"Value is not serializable and cannot be frozen")}}),t}(kn),ga=new ya,ma=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Ca(e))this.identifier=e;else{if(!Qn(e))throw ci("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ti(e);if(!r.identifierAttribute)throw ci("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw ci("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Na(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new _a("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),_a=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return hn(t,e),t}(Error),wa=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Reference}),n}return hn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Ca(e)?Gn():Kn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){_n(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&An.Object)>0?this.replaceRef(void 0):_n(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ti(n),a=function(n,a){var o=function(e){switch(e){case pn.beforeDestroy:return"destroy";case pn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(pn.beforeDetach,a),u=i.registerHook(pn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(pn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Na(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Yn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(pn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(pn.afterAttach,(function(){a(!1)})))}}}),t}(kn),Oa=function(e){function t(t,r){return e.call(this,t,r)||this}return hn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Qn(n)?(ei(i=n),ti(i).identifier):n,o=new ma(n,this.targetType),u=Zn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Qn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(wa),Pa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return hn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Qn(n)?this.options.set(n,e?e.storedValue:null):n,a=Zn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Qn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(wa);function ja(e,t){Rn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Pa(e,{get:r.get,set:r.set},n):new Oa(e,n)}var Sa=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Identifier}),n}return hn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Wi))throw ci("Identifier types can only be instantiated as direct child of a model type");return Zn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw ci("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Kn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Gn()}}),t}(kn),Aa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Identifier}),t}return hn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(Sa),Ea=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(Sa),Ta=new Aa,Ia=new Ea;function Na(e){return""+e}function Ca(e){return"string"==typeof e||"number"==typeof e}var Va=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:An.Custom}),r}return hn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Gn();var r=this.options.getValidationMessage(e);return r?Kn(t,e,"Invalid value for type '"+this.name+"': "+r):Gn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Zn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(kn),xa={enumeration:function(e,t){var r="string"==typeof e?t:e,n=sa.apply(void 0,gn(r.map((function(e){return aa(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Rn(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ga:Dn(e)?new ya(e):ca(ga,e)},identifier:Ta,identifierNumber:Ia,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new da(r,"string"==typeof e?t:e)},lazy:function(e,t){return new va(e,t)},undefined:ta,null:ea,snapshotProcessor:function(e,t,r){return Rn(),new xi(e,t,r)}};const ka=require("benchmark");k;var Da=new(e.n(ka)().Suite);const Ra={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ra[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Get a view with a parameter twice (should not be cached)",(()=>{void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;const e=xa.model({id:xa.identifier,name:xa.string,age:xa.number}),t=xa.model({users:xa.array(e)}).views((e=>({get numberOfChildren(){return e.users.filter((e=>e.age<18)).length},numberOfPeopleOlderThan:t=>e.users.filter((e=>e.age>t)).length}))).create({users:[{id:"1",name:"John",age:42},{id:"2",name:"Jane",age:47}]});return t.numberOfPeopleOlderThan(50),t.numberOfPeopleOlderThan(50)})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/get-a-view-with-a-parameter-twice-should-not-be-cached-node-bundle.js.LICENSE.txt b/build/get-a-view-with-a-parameter-twice-should-not-be-cached-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/get-a-view-with-a-parameter-twice-should-not-be-cached-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/get-a-view-with-a-parameter-twice-should-not-be-cached-web-bundle.js b/build/get-a-view-with-a-parameter-twice-should-not-be-cached-web-bundle.js new file mode 100644 index 0000000..c9d9c64 --- /dev/null +++ b/build/get-a-view-with-a-parameter-twice-should-not-be-cached-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see get-a-view-with-a-parameter-twice-should-not-be-cached-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,P=a.floor,j=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:j(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=j(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,P=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,P.elapsed=(m-P.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,P.cycle=f*e.count,P.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",P="[object Number]",j="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Pe="\\u2700-\\u27bf",je="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+Pe+"]",Ne="["+je+"]",Ve="[^"+we+xe+Ie+Pe+je+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[P]=it[j]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[P]=ot[j]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function Pt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function jt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,Pe=t.Math,je=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=je.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(je),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(je.getPrototypeOf,je),He=je.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(je,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=Pe.ceil,ht=Pe.floor,dt=je.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(je.keys,je),vn=Pe.max,yn=Pe.min,gn=ie.now,_n=t.parseInt,mn=Pe.random,wn=Ee.reverse,On=lo(t,"DataView"),Pn=lo(t,"Map"),jn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(je,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(Pn),kn=Mo(jn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==j||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case P:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?je(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=je(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(Pn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!Pn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in je(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(jo(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Pi(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=je(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return Pt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?Pt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var Pa=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),ja=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&Pr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&Pr(e)==g};function Xa(e){if(!eu(e))return!1;var t=Pr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=Pr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&Pr(e)==P}function ru(e){if(!eu(e)||Pr(e)!=j)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&Pr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&Pr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&Pr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[Pr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),Pu=Kr((function(e,t){e=je(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return Pt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),Pl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),Pt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==Pr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,jr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),jr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var B=Symbol("mobx-stored-annotations");function F(e){return Object.assign((function(t,n){U(t,n,e)}),e)}function U(e,t,n){T(e,B)||w(e,B,V({},e[B])),function(e){return e.annotationType_===Y}(n)||(e[B][t]=n)}var W=Symbol("mobx administration"),$=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=He.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=lt.inBatch?lt.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){lt.inBatch&&this.batchId_===lt.batchId||(lt.stateVersion=lt.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&ct(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,st(s,e))}r!==He.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),it(r),i}function Qe(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)ct(t[n],e);e.dependenciesState_=He.NOT_TRACKING_}function et(e){var t=tt();try{return e()}finally{nt(t)}}function tt(){var e=lt.trackingDerivation;return lt.trackingDerivation=null,e}function nt(e){lt.trackingDerivation=e}function rt(e){var t=lt.allowStateReads;return lt.allowStateReads=e,t}function it(e){lt.allowStateReads=e}function ot(e){if(e.dependenciesState_!==He.UP_TO_DATE_){e.dependenciesState_=He.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=He.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ut=!0,lt=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(ut=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new at).version&&(ut=!1),ut?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new at):(setTimeout((function(){e(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function ct(e,t){e.observers_.delete(t),0===e.observers_.size&&ft(e)}function ft(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,lt.pendingUnobservations.push(e))}function pt(){0===lt.inBatch&&(lt.batchId=lt.batchId0&&ft(e),!1)}function dt(e){e.lowestObserverState_!==He.STALE_&&(e.lowestObserverState_=He.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===He.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=He.STALE_})))}var vt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=He.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ge.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,lt.pendingReactions.push(this),_t())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){pt(),this.isScheduled_=!1;var e=lt.trackingContext;if(lt.trackingContext=this,Ze(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}lt.trackingContext=e,ht()}},t.track=function(e){if(!this.isDisposed_){pt(),this.isRunning_=!0;var t=lt.trackingContext;lt.trackingContext=this;var n=Je(this,e,void 0);lt.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Qe(this),Ye(n)&&this.reportExceptionInDerivation_(n.cause),ht()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(lt.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";lt.suppressReactionErrors||console.error(n,e),lt.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(pt(),Qe(this),ht()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[W]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),yt=100,gt=function(e){return e()};function _t(){lt.inBatch>0||lt.isRunningReactions||gt(mt)}function mt(){lt.isRunningReactions=!0;for(var e=lt.pendingReactions,t=0;e.length>0;){++t===yt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Me(t,n,e):y(n)?U(t,n,e?At:jt):y(t)?F(Z(e?Pt:Ot,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,jt);var Ct=Et(!0);function It(e){return Le(e.name,!1,e,this,void 0)}function kt(e){return v(e)&&!0===e.isMobxAction}function Nt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Dt(t),f=!1;u=new vt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new vt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Ct,At),Tt.bound=F(St),Ct.bound=F(xt);var Vt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Vt}var Rt="onBO",Mt="onBUO";function Lt(e,t,n){return zt(Mt,e,t,n)}function zt(e,t,n,r){var i="function"==typeof r?nr(t,n):nr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var Bt=0;function Ft(){this.message="FLOW_CANCELLED"}Ft.prototype=Object.create(Error.prototype);var Ut=te("flow"),Wt=te("flow.bound",{bound:!0}),$t=Object.assign((function(e,t){if(y(t))return U(e,t,Ut);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++Bt,o=Tt(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Tt(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Tt(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Tt(r+" - runid: "+i+" - cancel",(function(){try{a&&Ht(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),Ht(n),e(new Ft)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ut);function Ht(e){v(e.cancel)&&e.cancel()}function Gt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Kt(e,t,n){var r;return Nn(e)||An(e)||$e(e)?r=rr(e):Wn(e)&&(r=rr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function qt(e,t,n){return v(n)?function(e,t,n){return rr(e,t).intercept_(n)}(e,t,n):function(e,t){return rr(e).intercept_(t)}(e,t)}function Xt(e){return function(e,t){return!!e&&(void 0!==t?!!Wn(e)&&e[W].values_.has(t):Wn(e)||!!e[W]||H(e)||wt(e)||qe(e))}(e)}function Yt(t){return Wn(t)?t[W].keys_():Nn(t)||Rn(t)?Array.from(t.keys()):An(t)?t.map((function(e,t){return t})):void e(5)}function Zt(t){return Wn(t)?Yt(t).map((function(e){return t[e]})):Nn(t)?Yt(t).map((function(e){return t.get(e)})):Rn(t)?Array.from(t.values()):An(t)?t.slice():void e(6)}function Jt(t,n,r){if(2!==arguments.length||Rn(t))Wn(t)?t[W].set_(n,r):Nn(t)?t.set(n,r):Rn(t)?t.add(n):An(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),pt(),n>=t.length&&(t.length=n+1),t[n]=r,ht()):e(8);else{pt();var i=n;try{for(var o in i)Jt(t,o,i[o])}finally{ht()}}}function Qt(t,n,r){if(Wn(t))return t[W].defineProperty_(n,r);e(39)}function en(e,t,n,r){return v(n)?function(e,t,n,r){return rr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return rr(e).observe_(t,n)}(e,t,n)}function tn(e,t){void 0===t&&(t=void 0),pt();try{return e.apply(t)}finally{ht()}}function nn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=rn(e,n,V({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):rn(e,t,n||{})}function rn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[W].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Me("When-effect",t),a=Nt((function(t){ze(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function on(e){return e[W]}$t.bound=F(Wt);var an={has:function(e,t){return on(e).has_(t)},get:function(e,t){return on(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=on(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=on(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=on(e).defineProperty_(t,n))||r},ownKeys:function(e){return on(e).ownKeys_()},preventExtensions:function(t){e(13)}};function un(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function ln(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function sn(t,n){var r=tt();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function fn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function pn(e,t){var n=tt(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return ln(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),fn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&er(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),un(this)){var o=sn(this,{object:this.proxy_,type:hn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function _n(e,t){"function"==typeof Array.prototype[e]&&(gn[e]=t(e))}function mn(e){return function(){var t=this[W];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function wn(e){return function(t,n){var r=this,i=this[W];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function On(e){return function(){var t=this,n=this[W];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}_n("concat",mn),_n("flat",mn),_n("includes",mn),_n("indexOf",mn),_n("join",mn),_n("lastIndexOf",mn),_n("slice",mn),_n("toString",mn),_n("toLocaleString",mn),_n("every",wn),_n("filter",wn),_n("find",wn),_n("findIndex",wn),_n("flatMap",wn),_n("forEach",wn),_n("map",wn),_n("some",wn),_n("reduce",On),_n("reduceRight",On);var Pn,jn,Sn=P("ObservableArrayAdministration",vn);function An(e){return g(e)&&Sn(e[W])}var xn={},En="add",Tn="delete";Pn=Symbol.iterator,jn=Symbol.toStringTag;var Cn,In,kn=function(){function t(t,n,r){var i=this;void 0===n&&(n=q),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[W]=xn,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),or((function(){i.keysAtom_=G("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!lt.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new We(this.has_(e),X,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Lt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(un(this)){var r=sn(this,{type:n?bn:En,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,un(this)&&!sn(this,{type:Tn,object:this,name:e}))return!1;if(this.has_(e)){var n=cn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:Tn,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return tn((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&pn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==lt.UNCHANGED){var r=cn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:bn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&pn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,tn((function(){var r,i=new We(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=cn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,name:e,newValue:t}:null;r&&pn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return cr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return cr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[Pn]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=z(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return Nn(t)&&(t=new Map(t)),tn((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):j(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;tn((function(){et((function(){for(var t,n=z(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return tn((function(){for(var r,i=function(t){if(j(t)||Nn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=z(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=z(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return fn(this,e)},n.intercept_=function(e){return ln(this,e)},N(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),Nn=P("ObservableMap",kn),Vn={};Cn=Symbol.iterator,In=Symbol.toStringTag;var Dn=function(){function t(t,n,r){var i=this;void 0===n&&(n=q),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[W]=Vn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},or((function(){i.atom_=G(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;tn((function(){et((function(){for(var t,n=z(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=z(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,un(this)&&!sn(this,{type:En,object:this,newValue:e}))return this;if(!this.has(e)){tn((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=cn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,newValue:e}:null;n&&pn(this,r)}return this},n.delete=function(e){var t=this;if(un(this)&&!sn(this,{type:Tn,object:this,oldValue:e}))return!1;if(this.has(e)){var n=cn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:Tn,object:this,oldValue:e}:null;return tn((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&pn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return cr({next:function(){var r=e;return e+=1,rXn){for(var t=Xn;t=0&&n++}e=sr(e),t=sr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!lr(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!lr(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function sr(e){return An(e)?e.slice():j(e)||Nn(e)||S(e)||Rn(e)?Array.from(e.entries()):e}function cr(e){return e[Symbol.iterator]=fr,e}function fr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:ir},$mobx:W});var pr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(pr||(pr={}));var hr=function(e,t){return hr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},hr(e,t)};function br(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}hr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var dr=function(){return dr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function yr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function gr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Pr);jr.prototype.die=Tt(jr.prototype.die);var Sr,Ar,xr=1,Er={onError:function(e){throw e}},Tr=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++xr}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ie((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Yr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw ci("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Io(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return br(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=vr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=li,this.state=qr.CREATED,e){this.fireHook(pr.afterCreate),this.finalizeCreation();try{for(var c=vr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(pr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(pr.beforeDetach);var e=this.state;this.state=qr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(pr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(It?It((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw ci(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&Ei(e.subpath)||"",r=e.actionContext||Mr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(ei(i=r.context,1),ti(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(li),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):oi(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw ci("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=vr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(pr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw ci("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=zr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Pi(e,"/")||Pi(e,"./")||Pi(e,"../")))throw ci("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ii(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=zr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),_i(this.storedValue,"$treenode",this),_i(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Tt(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Dt(r),y=!0,g=!1,_=r.compareStructural?K.structural:r.equals||K.default,m=new vt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=ze(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),Er);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new wi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Mr,Lr=1;function zr(e,t,n){var r=function(){var r=Lr++,i=Mr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ti(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Mr;Mr=e;try{return function(e,t,n){var r=new Br(e,n);if(r.isEmpty)return Tt(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&pr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Tt(n).apply(null,t.args)}(t)}(n,e,t)}finally{Mr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:Oi(arguments),context:e,tree:Or(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?gr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var Br=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Fr(e){return"function"==typeof e?"":Qr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Ur(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Qr(t)?"value of type "+ti(t).type.name+":":yi(t)?"value":"snapshot",a=n&&Qr(t)&&n.is(ti(t).snapshot);return""+i+o+" "+Fr(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Dr(e)&&(e.flags&(Ar.String|Ar.Number|Ar.Integer|Ar.Boolean|Ar.Date))>0}(n)||yi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Wr(e,t,n){return e.concat([{path:t,type:n}])}function $r(){return ui}function Hr(e,t,n){return[{context:e,value:t,message:n}]}function Gr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Kr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw ci(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Fr(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Ur).join("\n ")}(e,t,n))}(e,t)}var qr,Xr=0,Yr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Xr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:xe.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:xe.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,xe.array([],si));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw ci("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Zt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Wn(r)?Yt(r).map((function(e){return[e,r[e]]})):Nn(r)?Yt(r).map((function(e){return[e,r.get(e)]})):Rn(r)?Array.from(r.entries()):An(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=yr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw ci("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Zr(e,t,n,r,i){var o=ni(i);if(o){if(o.parent)throw ci("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Tr(e,t,n,r,i)}function Jr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Qr(e){return!(!e||!e.$treenode)}function ei(e,t){ji()}function ti(e){if(!Qr(e))throw ci("Value "+e+" is no MST Node");return e.$treenode}function ni(e){return e&&e.$treenode||null}function ri(){return ti(this).snapshot}function ii(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Qr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Qr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===ki?Hr(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dr(e)?this._subtype:Qr(e)?wr(e,!1):this.preProcessSnapshotSafe(e);return t!==ki&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Nr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(kr),Vi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var n,r,i=e.getSubTypes();if(i===Cr)return!1;if(i){var o=bi(i);try{for(var a=vr(o),u=a.next();!u.done;u=a.next())if(!Di(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Gi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ii||(Ii={}));var Ri=function(e){function t(t,n){return e.call(this,t,xe.ref.enhancer,n)||this}return br(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw ci("Map.put cannot be used to set empty values");if(Qr(e)){var t=ti(e);if(null===t.identifier)throw ci(Vi);return this.set(t.identifier,e),e}if(vi(e)){var n=ti(this),r=n.type;if(r.identifierMode!==Ii.YES)throw ci(Vi);var i=e[r.mapIdentifierAttribute];if(!ko(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(wr(o))}var a=Io(i);return this.set(a,e),this.get(a)}throw ci("Map.put can only be used to store complex values")}}),t}(kn),Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ii.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return br(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ii.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw ci("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ii.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ii.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Ri(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Kt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=zr(t,e,r);_i(t,e,i)}))})),qt(t,this.willChange),en(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Zt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw ci("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ti(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Kr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Kr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ii.YES&&t instanceof Tr){var n=t.identifier;if(n!==e)throw ci("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ti(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Kr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return di(e)?Gr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Wr(t,r,n._subType))}))):Hr(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return li}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Nr);Mi.prototype.applySnapshot=Tt(Mi.prototype.applySnapshot);var Li=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return br(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=dr(dr({},si),{name:this.name});return xe.array(oi(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){rr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=zr(t,e,r);_i(t,e,i)}))})),qt(t,this.willChange),en(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Qr(e)?ti(e).snapshot:e;return this._predicate(r)?$r():Hr(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(kr),uo=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=dr({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return br(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Ar.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw ci("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw ci("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Kr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?$r():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(kr);function co(e,t,n){return function(e,t){if("function"!=typeof t&&Qr(t))throw ci("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Rr()}(0,t),new so(e,t,n||fo)}var fo=[void 0],po=co(to,void 0),ho=co(eo,null);function bo(e){return Rr(),lo(e,po)}var vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return br(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Ar.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw ci("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):$r()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Cr}}),t}(kr),yo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:xe.array()}),nn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Tt((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return br(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Jr(this,e,t,n,r);return this.pendingNodeList.push(o),nn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):gi(e)?$r():Hr(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Vr),go=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Frozen}),n}return br(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Jr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return gi(e)?this.subType?this.subType.validate(e,t):$r():Hr(t,e,"Value is not serializable and cannot be frozen")}}),t}(Vr),_o=new go,mo=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),ko(e))this.identifier=e;else{if(!Qr(e))throw ci("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ti(e);if(!n.identifierAttribute)throw ci("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw ci("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Io(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new wo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),wo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return br(t,e),t}(Error),Oo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Reference}),r}return br(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return ko(e)?$r():Hr(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){mr(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dr(e=i.type)&&(e.flags&Ar.Object)>0?this.replaceRef(void 0):mr(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ti(r),o=function(r,o){var a=function(e){switch(e){case pr.beforeDestroy:return"destroy";case pr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(pr.beforeDetach,o),u=i.registerHook(pr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(pr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Io(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(pr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(pr.afterAttach,(function(){o(!1)})))}}}),t}(Vr),Po=function(e){function t(t,n){return e.call(this,t,n)||this}return br(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Qr(r)?(ei(i=r),ti(i).identifier):r,a=new mo(r,this.targetType),u=Jr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Qr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(Oo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return br(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Qr(r)?this.options.set(r,e?e.storedValue:null):r,o=Jr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Qr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(Oo);function So(e,t){Rr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Po(e,r)}var Ao=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Identifier}),r}return br(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Gi))throw ci("Identifier types can only be instantiated as direct child of a model type");return Jr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw ci("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Hr(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):$r()}}),t}(Vr),xo=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Identifier}),t}return br(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(Ao),Eo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return br(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(Ao),To=new xo,Co=new Eo;function Io(e){return""+e}function ko(e){return"string"==typeof e||"number"==typeof e}var No=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Custom}),n}return br(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return $r();var n=this.options.getValidationMessage(e);return n?Hr(t,e,"Invalid value for type '"+this.name+"': "+n):$r()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Jr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Vr),Vo={enumeration:function(e,t){var n="string"==typeof e?t:e,r=lo.apply(void 0,gr(n.map((function(e){return oo(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Rr(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?_o:Dr(e)?new go(e):co(_o,e)},identifier:To,identifierNumber:Co,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new vo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new yo(e,t)},undefined:to,null:eo,snapshotProcessor:function(e,t,n){return Rr(),new Ni(e,t,n)}},Do=n(215);k;var Ro=new(n.n(Do)().Suite);const Mo={};Ro.on("complete",(function(){const e=Ro.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Mo[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Ro.add("Get a view with a parameter twice (should not be cached)",(()=>{void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;const e=Vo.model({id:Vo.identifier,name:Vo.string,age:Vo.number}),t=Vo.model({users:Vo.array(e)}).views((e=>({get numberOfChildren(){return e.users.filter((e=>e.age<18)).length},numberOfPeopleOlderThan:t=>e.users.filter((e=>e.age>t)).length}))).create({users:[{id:"1",name:"John",age:42},{id:"2",name:"Jane",age:47}]});return t.numberOfPeopleOlderThan(50),t.numberOfPeopleOlderThan(50)})),Ro.on("cycle",(function(e){console.log(String(e.target))})),Ro.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/get-a-view-with-a-parameter-twice-should-not-be-cached-web-bundle.js.LICENSE.txt b/build/get-a-view-with-a-parameter-twice-should-not-be-cached-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/get-a-view-with-a-parameter-twice-should-not-be-cached-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/get-a-view-with-a-parameter-web-bundle.js b/build/get-a-view-with-a-parameter-web-bundle.js new file mode 100644 index 0000000..ada7479 --- /dev/null +++ b/build/get-a-view-with-a-parameter-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see get-a-view-with-a-parameter-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,P=a.floor,j=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:j(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=j(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,P=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,P.elapsed=(m-P.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,P.cycle=f*e.count,P.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",P="[object Number]",j="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Pe="\\u2700-\\u27bf",je="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+Pe+"]",Ne="["+je+"]",Ve="[^"+we+xe+Ie+Pe+je+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[P]=it[j]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[P]=ot[j]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function Pt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function jt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,Pe=t.Math,je=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=je.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(je),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(je.getPrototypeOf,je),He=je.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(je,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=Pe.ceil,ht=Pe.floor,dt=je.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(je.keys,je),vn=Pe.max,yn=Pe.min,gn=ie.now,_n=t.parseInt,mn=Pe.random,wn=Ee.reverse,On=lo(t,"DataView"),Pn=lo(t,"Map"),jn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(je,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(Pn),kn=Mo(jn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==j||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case P:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?je(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=je(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(Pn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!Pn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in je(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(jo(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Pi(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=je(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return Pt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?Pt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var Pa=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),ja=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&Pr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&Pr(e)==g};function Xa(e){if(!eu(e))return!1;var t=Pr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=Pr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&Pr(e)==P}function ru(e){if(!eu(e)||Pr(e)!=j)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&Pr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&Pr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&Pr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[Pr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),Pu=Kr((function(e,t){e=je(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return Pt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),Pl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),Pt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==Pr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,jr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),jr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var B=Symbol("mobx-stored-annotations");function F(e){return Object.assign((function(t,n){U(t,n,e)}),e)}function U(e,t,n){T(e,B)||w(e,B,V({},e[B])),function(e){return e.annotationType_===Y}(n)||(e[B][t]=n)}var W=Symbol("mobx administration"),$=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=He.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=lt.inBatch?lt.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){lt.inBatch&&this.batchId_===lt.batchId||(lt.stateVersion=lt.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&ct(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,st(s,e))}r!==He.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),it(r),i}function Qe(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)ct(t[n],e);e.dependenciesState_=He.NOT_TRACKING_}function et(e){var t=tt();try{return e()}finally{nt(t)}}function tt(){var e=lt.trackingDerivation;return lt.trackingDerivation=null,e}function nt(e){lt.trackingDerivation=e}function rt(e){var t=lt.allowStateReads;return lt.allowStateReads=e,t}function it(e){lt.allowStateReads=e}function ot(e){if(e.dependenciesState_!==He.UP_TO_DATE_){e.dependenciesState_=He.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=He.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ut=!0,lt=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(ut=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new at).version&&(ut=!1),ut?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new at):(setTimeout((function(){e(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function ct(e,t){e.observers_.delete(t),0===e.observers_.size&&ft(e)}function ft(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,lt.pendingUnobservations.push(e))}function pt(){0===lt.inBatch&&(lt.batchId=lt.batchId0&&ft(e),!1)}function dt(e){e.lowestObserverState_!==He.STALE_&&(e.lowestObserverState_=He.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===He.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=He.STALE_})))}var vt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=He.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ge.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,lt.pendingReactions.push(this),_t())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){pt(),this.isScheduled_=!1;var e=lt.trackingContext;if(lt.trackingContext=this,Ze(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}lt.trackingContext=e,ht()}},t.track=function(e){if(!this.isDisposed_){pt(),this.isRunning_=!0;var t=lt.trackingContext;lt.trackingContext=this;var n=Je(this,e,void 0);lt.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Qe(this),Ye(n)&&this.reportExceptionInDerivation_(n.cause),ht()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(lt.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";lt.suppressReactionErrors||console.error(n,e),lt.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(pt(),Qe(this),ht()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[W]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),yt=100,gt=function(e){return e()};function _t(){lt.inBatch>0||lt.isRunningReactions||gt(mt)}function mt(){lt.isRunningReactions=!0;for(var e=lt.pendingReactions,t=0;e.length>0;){++t===yt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Me(t,n,e):y(n)?U(t,n,e?At:jt):y(t)?F(Z(e?Pt:Ot,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,jt);var Ct=Et(!0);function It(e){return Le(e.name,!1,e,this,void 0)}function kt(e){return v(e)&&!0===e.isMobxAction}function Nt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Dt(t),f=!1;u=new vt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new vt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Ct,At),Tt.bound=F(St),Ct.bound=F(xt);var Vt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Vt}var Rt="onBO",Mt="onBUO";function Lt(e,t,n){return zt(Mt,e,t,n)}function zt(e,t,n,r){var i="function"==typeof r?nr(t,n):nr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var Bt=0;function Ft(){this.message="FLOW_CANCELLED"}Ft.prototype=Object.create(Error.prototype);var Ut=te("flow"),Wt=te("flow.bound",{bound:!0}),$t=Object.assign((function(e,t){if(y(t))return U(e,t,Ut);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++Bt,o=Tt(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Tt(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Tt(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Tt(r+" - runid: "+i+" - cancel",(function(){try{a&&Ht(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),Ht(n),e(new Ft)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ut);function Ht(e){v(e.cancel)&&e.cancel()}function Gt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Kt(e,t,n){var r;return Nn(e)||An(e)||$e(e)?r=rr(e):Wn(e)&&(r=rr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function qt(e,t,n){return v(n)?function(e,t,n){return rr(e,t).intercept_(n)}(e,t,n):function(e,t){return rr(e).intercept_(t)}(e,t)}function Xt(e){return function(e,t){return!!e&&(void 0!==t?!!Wn(e)&&e[W].values_.has(t):Wn(e)||!!e[W]||H(e)||wt(e)||qe(e))}(e)}function Yt(t){return Wn(t)?t[W].keys_():Nn(t)||Rn(t)?Array.from(t.keys()):An(t)?t.map((function(e,t){return t})):void e(5)}function Zt(t){return Wn(t)?Yt(t).map((function(e){return t[e]})):Nn(t)?Yt(t).map((function(e){return t.get(e)})):Rn(t)?Array.from(t.values()):An(t)?t.slice():void e(6)}function Jt(t,n,r){if(2!==arguments.length||Rn(t))Wn(t)?t[W].set_(n,r):Nn(t)?t.set(n,r):Rn(t)?t.add(n):An(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),pt(),n>=t.length&&(t.length=n+1),t[n]=r,ht()):e(8);else{pt();var i=n;try{for(var o in i)Jt(t,o,i[o])}finally{ht()}}}function Qt(t,n,r){if(Wn(t))return t[W].defineProperty_(n,r);e(39)}function en(e,t,n,r){return v(n)?function(e,t,n,r){return rr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return rr(e).observe_(t,n)}(e,t,n)}function tn(e,t){void 0===t&&(t=void 0),pt();try{return e.apply(t)}finally{ht()}}function nn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=rn(e,n,V({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):rn(e,t,n||{})}function rn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[W].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Me("When-effect",t),a=Nt((function(t){ze(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function on(e){return e[W]}$t.bound=F(Wt);var an={has:function(e,t){return on(e).has_(t)},get:function(e,t){return on(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=on(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=on(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=on(e).defineProperty_(t,n))||r},ownKeys:function(e){return on(e).ownKeys_()},preventExtensions:function(t){e(13)}};function un(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function ln(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function sn(t,n){var r=tt();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function fn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function pn(e,t){var n=tt(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return ln(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),fn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&er(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),un(this)){var o=sn(this,{object:this.proxy_,type:hn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function _n(e,t){"function"==typeof Array.prototype[e]&&(gn[e]=t(e))}function mn(e){return function(){var t=this[W];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function wn(e){return function(t,n){var r=this,i=this[W];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function On(e){return function(){var t=this,n=this[W];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}_n("concat",mn),_n("flat",mn),_n("includes",mn),_n("indexOf",mn),_n("join",mn),_n("lastIndexOf",mn),_n("slice",mn),_n("toString",mn),_n("toLocaleString",mn),_n("every",wn),_n("filter",wn),_n("find",wn),_n("findIndex",wn),_n("flatMap",wn),_n("forEach",wn),_n("map",wn),_n("some",wn),_n("reduce",On),_n("reduceRight",On);var Pn,jn,Sn=P("ObservableArrayAdministration",vn);function An(e){return g(e)&&Sn(e[W])}var xn={},En="add",Tn="delete";Pn=Symbol.iterator,jn=Symbol.toStringTag;var Cn,In,kn=function(){function t(t,n,r){var i=this;void 0===n&&(n=q),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[W]=xn,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),or((function(){i.keysAtom_=G("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!lt.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new We(this.has_(e),X,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Lt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(un(this)){var r=sn(this,{type:n?bn:En,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,un(this)&&!sn(this,{type:Tn,object:this,name:e}))return!1;if(this.has_(e)){var n=cn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:Tn,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return tn((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&pn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==lt.UNCHANGED){var r=cn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:bn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&pn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,tn((function(){var r,i=new We(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=cn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,name:e,newValue:t}:null;r&&pn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return cr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return cr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[Pn]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=z(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return Nn(t)&&(t=new Map(t)),tn((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):j(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;tn((function(){et((function(){for(var t,n=z(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return tn((function(){for(var r,i=function(t){if(j(t)||Nn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=z(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=z(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return fn(this,e)},n.intercept_=function(e){return ln(this,e)},N(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),Nn=P("ObservableMap",kn),Vn={};Cn=Symbol.iterator,In=Symbol.toStringTag;var Dn=function(){function t(t,n,r){var i=this;void 0===n&&(n=q),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[W]=Vn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},or((function(){i.atom_=G(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;tn((function(){et((function(){for(var t,n=z(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=z(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,un(this)&&!sn(this,{type:En,object:this,newValue:e}))return this;if(!this.has(e)){tn((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=cn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,newValue:e}:null;n&&pn(this,r)}return this},n.delete=function(e){var t=this;if(un(this)&&!sn(this,{type:Tn,object:this,oldValue:e}))return!1;if(this.has(e)){var n=cn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:Tn,object:this,oldValue:e}:null;return tn((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&pn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return cr({next:function(){var r=e;return e+=1,rXn){for(var t=Xn;t=0&&n++}e=sr(e),t=sr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!lr(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!lr(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function sr(e){return An(e)?e.slice():j(e)||Nn(e)||S(e)||Rn(e)?Array.from(e.entries()):e}function cr(e){return e[Symbol.iterator]=fr,e}function fr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:ir},$mobx:W});var pr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(pr||(pr={}));var hr=function(e,t){return hr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},hr(e,t)};function br(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}hr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var dr=function(){return dr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function yr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function gr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Pr);jr.prototype.die=Tt(jr.prototype.die);var Sr,Ar,xr=1,Er={onError:function(e){throw e}},Tr=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++xr}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ie((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Yr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw ci("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Io(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return br(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=vr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=li,this.state=qr.CREATED,e){this.fireHook(pr.afterCreate),this.finalizeCreation();try{for(var c=vr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(pr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(pr.beforeDetach);var e=this.state;this.state=qr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(pr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(It?It((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw ci(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&Ei(e.subpath)||"",r=e.actionContext||Mr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(ei(i=r.context,1),ti(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(li),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):oi(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw ci("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=vr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(pr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw ci("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=zr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Pi(e,"/")||Pi(e,"./")||Pi(e,"../")))throw ci("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ii(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=zr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),_i(this.storedValue,"$treenode",this),_i(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Tt(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Dt(r),y=!0,g=!1,_=r.compareStructural?K.structural:r.equals||K.default,m=new vt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=ze(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),Er);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new wi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Mr,Lr=1;function zr(e,t,n){var r=function(){var r=Lr++,i=Mr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ti(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Mr;Mr=e;try{return function(e,t,n){var r=new Br(e,n);if(r.isEmpty)return Tt(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&pr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Tt(n).apply(null,t.args)}(t)}(n,e,t)}finally{Mr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:Oi(arguments),context:e,tree:Or(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?gr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var Br=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Fr(e){return"function"==typeof e?"":Qr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Ur(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Qr(t)?"value of type "+ti(t).type.name+":":yi(t)?"value":"snapshot",a=n&&Qr(t)&&n.is(ti(t).snapshot);return""+i+o+" "+Fr(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Dr(e)&&(e.flags&(Ar.String|Ar.Number|Ar.Integer|Ar.Boolean|Ar.Date))>0}(n)||yi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Wr(e,t,n){return e.concat([{path:t,type:n}])}function $r(){return ui}function Hr(e,t,n){return[{context:e,value:t,message:n}]}function Gr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Kr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw ci(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Fr(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Ur).join("\n ")}(e,t,n))}(e,t)}var qr,Xr=0,Yr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Xr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:xe.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:xe.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,xe.array([],si));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw ci("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Zt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Wn(r)?Yt(r).map((function(e){return[e,r[e]]})):Nn(r)?Yt(r).map((function(e){return[e,r.get(e)]})):Rn(r)?Array.from(r.entries()):An(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=yr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw ci("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Zr(e,t,n,r,i){var o=ni(i);if(o){if(o.parent)throw ci("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Tr(e,t,n,r,i)}function Jr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Qr(e){return!(!e||!e.$treenode)}function ei(e,t){ji()}function ti(e){if(!Qr(e))throw ci("Value "+e+" is no MST Node");return e.$treenode}function ni(e){return e&&e.$treenode||null}function ri(){return ti(this).snapshot}function ii(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Qr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Qr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===ki?Hr(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dr(e)?this._subtype:Qr(e)?wr(e,!1):this.preProcessSnapshotSafe(e);return t!==ki&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Nr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(kr),Vi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var n,r,i=e.getSubTypes();if(i===Cr)return!1;if(i){var o=bi(i);try{for(var a=vr(o),u=a.next();!u.done;u=a.next())if(!Di(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Gi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ii||(Ii={}));var Ri=function(e){function t(t,n){return e.call(this,t,xe.ref.enhancer,n)||this}return br(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw ci("Map.put cannot be used to set empty values");if(Qr(e)){var t=ti(e);if(null===t.identifier)throw ci(Vi);return this.set(t.identifier,e),e}if(vi(e)){var n=ti(this),r=n.type;if(r.identifierMode!==Ii.YES)throw ci(Vi);var i=e[r.mapIdentifierAttribute];if(!ko(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(wr(o))}var a=Io(i);return this.set(a,e),this.get(a)}throw ci("Map.put can only be used to store complex values")}}),t}(kn),Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ii.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return br(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ii.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw ci("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ii.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ii.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Ri(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Kt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=zr(t,e,r);_i(t,e,i)}))})),qt(t,this.willChange),en(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Zt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw ci("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ti(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Kr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Kr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ii.YES&&t instanceof Tr){var n=t.identifier;if(n!==e)throw ci("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ti(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Kr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return di(e)?Gr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Wr(t,r,n._subType))}))):Hr(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return li}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Nr);Mi.prototype.applySnapshot=Tt(Mi.prototype.applySnapshot);var Li=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return br(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=dr(dr({},si),{name:this.name});return xe.array(oi(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){rr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=zr(t,e,r);_i(t,e,i)}))})),qt(t,this.willChange),en(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Qr(e)?ti(e).snapshot:e;return this._predicate(r)?$r():Hr(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(kr),uo=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=dr({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return br(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Ar.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw ci("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw ci("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Kr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?$r():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(kr);function co(e,t,n){return function(e,t){if("function"!=typeof t&&Qr(t))throw ci("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Rr()}(0,t),new so(e,t,n||fo)}var fo=[void 0],po=co(to,void 0),ho=co(eo,null);function bo(e){return Rr(),lo(e,po)}var vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return br(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Ar.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw ci("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):$r()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Cr}}),t}(kr),yo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:xe.array()}),nn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Tt((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return br(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Jr(this,e,t,n,r);return this.pendingNodeList.push(o),nn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):gi(e)?$r():Hr(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Vr),go=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Frozen}),n}return br(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Jr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return gi(e)?this.subType?this.subType.validate(e,t):$r():Hr(t,e,"Value is not serializable and cannot be frozen")}}),t}(Vr),_o=new go,mo=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),ko(e))this.identifier=e;else{if(!Qr(e))throw ci("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ti(e);if(!n.identifierAttribute)throw ci("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw ci("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Io(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new wo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),wo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return br(t,e),t}(Error),Oo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Reference}),r}return br(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return ko(e)?$r():Hr(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){mr(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dr(e=i.type)&&(e.flags&Ar.Object)>0?this.replaceRef(void 0):mr(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ti(r),o=function(r,o){var a=function(e){switch(e){case pr.beforeDestroy:return"destroy";case pr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(pr.beforeDetach,o),u=i.registerHook(pr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(pr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Io(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(pr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(pr.afterAttach,(function(){o(!1)})))}}}),t}(Vr),Po=function(e){function t(t,n){return e.call(this,t,n)||this}return br(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Qr(r)?(ei(i=r),ti(i).identifier):r,a=new mo(r,this.targetType),u=Jr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Qr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(Oo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return br(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Qr(r)?this.options.set(r,e?e.storedValue:null):r,o=Jr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Qr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(Oo);function So(e,t){Rr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Po(e,r)}var Ao=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Identifier}),r}return br(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Gi))throw ci("Identifier types can only be instantiated as direct child of a model type");return Jr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw ci("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Hr(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):$r()}}),t}(Vr),xo=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Identifier}),t}return br(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(Ao),Eo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return br(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(Ao),To=new xo,Co=new Eo;function Io(e){return""+e}function ko(e){return"string"==typeof e||"number"==typeof e}var No=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Ar.Custom}),n}return br(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return $r();var n=this.options.getValidationMessage(e);return n?Hr(t,e,"Invalid value for type '"+this.name+"': "+n):$r()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Jr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Vr),Vo={enumeration:function(e,t){var n="string"==typeof e?t:e,r=lo.apply(void 0,gr(n.map((function(e){return oo(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Rr(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?_o:Dr(e)?new go(e):co(_o,e)},identifier:To,identifierNumber:Co,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new vo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new yo(e,t)},undefined:to,null:eo,snapshotProcessor:function(e,t,n){return Rr(),new Ni(e,t,n)}},Do=n(215);k;var Ro=new(n.n(Do)().Suite);const Mo={};Ro.on("complete",(function(){const e=Ro.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Mo[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Ro.add("Get a view with a parameter",(()=>{void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;const e=Vo.model({id:Vo.identifier,name:Vo.string,age:Vo.number});return Vo.model({users:Vo.array(e)}).views((e=>({get numberOfChildren(){return e.users.filter((e=>e.age<18)).length},numberOfPeopleOlderThan:t=>e.users.filter((e=>e.age>t)).length}))).create({users:[{id:"1",name:"John",age:42},{id:"2",name:"Jane",age:47}]}).numberOfPeopleOlderThan(50)})),Ro.on("cycle",(function(e){console.log(String(e.target))})),Ro.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/get-a-view-with-a-parameter-web-bundle.js.LICENSE.txt b/build/get-a-view-with-a-parameter-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/get-a-view-with-a-parameter-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/get-computed-value-once-bundle-source.js b/build/get-computed-value-once-bundle-source.js new file mode 100644 index 0000000..e137923 --- /dev/null +++ b/build/get-computed-value-once-bundle-source.js @@ -0,0 +1,112 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Get computed value once", () => { + const startMemory = getStartMemory(); + const User = types.model({ + id: types.identifier, + name: types.string, + age: types.number, +}); + +const UserStore = types + .model({ + users: types.array(User), + }) + .views((self) => ({ + get numberOfChildren() { + return self.users.filter((user) => user.age < 18).length; + }, + numberOfPeopleOlderThan(age) { + return self.users.filter((user) => user.age > age).length; + }, + })); + +const userStore = UserStore.create({ + users: [ + { id: "1", name: "John", age: 42 }, + { id: "2", name: "Jane", age: 47 }, + ], +}); + +const numberOfChildren = userStore.numberOfChildren; +return numberOfChildren; + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Get computed value once", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/get-computed-value-once-node-bundle.js b/build/get-computed-value-once-node-bundle.js new file mode 100644 index 0000000..8a260ec --- /dev/null +++ b/build/get-computed-value-once-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see get-computed-value-once-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===J}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,$e(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),Je(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U($(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function Jt(e){return Br(e)?e[F].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function $t(e){return Br(e)?Jt(e).map((function(t){return e[t]})):Cr(e)?Jt(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new Jn),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,Jn=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;$t(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?Jt(n).map((function(e){return[e,n[e]]})):Cr(n)?Jt(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function $n(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Ci?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Ci&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),$n(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return $t(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return $n(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Ca=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Va={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Vi(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Get computed value once",(()=>{void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;const e=Va.model({id:Va.identifier,name:Va.string,age:Va.number});return Va.model({users:Va.array(e)}).views((e=>({get numberOfChildren(){return e.users.filter((e=>e.age<18)).length},numberOfPeopleOlderThan:t=>e.users.filter((e=>e.age>t)).length}))).create({users:[{id:"1",name:"John",age:42},{id:"2",name:"Jane",age:47}]}).numberOfChildren})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/get-computed-value-once-node-bundle.js.LICENSE.txt b/build/get-computed-value-once-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/get-computed-value-once-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/get-computed-value-once-should-be-cached-bundle-source.js b/build/get-computed-value-once-should-be-cached-bundle-source.js new file mode 100644 index 0000000..52ae06d --- /dev/null +++ b/build/get-computed-value-once-should-be-cached-bundle-source.js @@ -0,0 +1,113 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Get computed value once (should be cached)", () => { + const startMemory = getStartMemory(); + const User = types.model({ + id: types.identifier, + name: types.string, + age: types.number, +}); + +const UserStore = types + .model({ + users: types.array(User), + }) + .views((self) => ({ + get numberOfChildren() { + return self.users.filter((user) => user.age < 18).length; + }, + numberOfPeopleOlderThan(age) { + return self.users.filter((user) => user.age > age).length; + }, + })); + +const userStore = UserStore.create({ + users: [ + { id: "1", name: "John", age: 42 }, + { id: "2", name: "Jane", age: 47 }, + ], +}); + +const numberOfChildren = userStore.numberOfChildren; +const numberOfChildrenAgain = userStore.numberOfChildren; +return numberOfChildrenAgain; + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Get computed value once (should be cached)", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/get-computed-value-once-should-be-cached-node-bundle.js b/build/get-computed-value-once-should-be-cached-node-bundle.js new file mode 100644 index 0000000..c3bb7f7 --- /dev/null +++ b/build/get-computed-value-once-should-be-cached-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see get-computed-value-once-should-be-cached-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===J}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,$e(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Xe(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),Je(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U($(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function Jt(e){return Br(e)?e[F].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function $t(e){return Br(e)?Jt(e).map((function(t){return e[t]})):Cr(e)?Jt(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Xt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Xt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new Jn),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,Jn=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;$t(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?Jt(n).map((function(e){return[e,n[e]]})):Cr(n)?Jt(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function $n(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Xn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Ci?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Ci&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),$n(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return $t(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return $n(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Xn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Xn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Xn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Ca=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Va={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Vi(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Get computed value once (should be cached)",(()=>{void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;const e=Va.model({id:Va.identifier,name:Va.string,age:Va.number}),t=Va.model({users:Va.array(e)}).views((e=>({get numberOfChildren(){return e.users.filter((e=>e.age<18)).length},numberOfPeopleOlderThan:t=>e.users.filter((e=>e.age>t)).length}))).create({users:[{id:"1",name:"John",age:42},{id:"2",name:"Jane",age:47}]});return t.numberOfChildren,t.numberOfChildren})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/get-computed-value-once-should-be-cached-node-bundle.js.LICENSE.txt b/build/get-computed-value-once-should-be-cached-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/get-computed-value-once-should-be-cached-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/get-computed-value-once-should-be-cached-web-bundle.js b/build/get-computed-value-once-should-be-cached-web-bundle.js new file mode 100644 index 0000000..b646539 --- /dev/null +++ b/build/get-computed-value-once-should-be-cached-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see get-computed-value-once-should-be-cached-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw si("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw si(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw si("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw si("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw si("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw si(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw si("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw si("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw si("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw si("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw si("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw si(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw si(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw si("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw si("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw si("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw si("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw si("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw si("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function so(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw si("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||co)}var co=[void 0],fo=so(eo,void 0),po=so(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw si("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw si("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw si("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw si("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw si("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw si("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):so(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Get computed value once (should be cached)",(()=>{void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;const e=No.model({id:No.identifier,name:No.string,age:No.number}),t=No.model({users:No.array(e)}).views((e=>({get numberOfChildren(){return e.users.filter((e=>e.age<18)).length},numberOfPeopleOlderThan:t=>e.users.filter((e=>e.age>t)).length}))).create({users:[{id:"1",name:"John",age:42},{id:"2",name:"Jane",age:47}]});return t.numberOfChildren,t.numberOfChildren})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/get-computed-value-once-should-be-cached-web-bundle.js.LICENSE.txt b/build/get-computed-value-once-should-be-cached-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/get-computed-value-once-should-be-cached-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/get-computed-value-once-web-bundle.js b/build/get-computed-value-once-web-bundle.js new file mode 100644 index 0000000..6268caf --- /dev/null +++ b/build/get-computed-value-once-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see get-computed-value-once-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw si("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw si(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw si("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw si("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw si("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw si(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw si("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw si("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw si("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw si("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw si("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw si(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw si(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw si("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw si("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw si("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw si("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw si("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw si("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function so(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw si("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||co)}var co=[void 0],fo=so(eo,void 0),po=so(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw si("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw si("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw si("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw si("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw si("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw si("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):so(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Get computed value once",(()=>{void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;const e=No.model({id:No.identifier,name:No.string,age:No.number});return No.model({users:No.array(e)}).views((e=>({get numberOfChildren(){return e.users.filter((e=>e.age<18)).length},numberOfPeopleOlderThan:t=>e.users.filter((e=>e.age>t)).length}))).create({users:[{id:"1",name:"John",age:42},{id:"2",name:"Jane",age:47}]}).numberOfChildren})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/get-computed-value-once-web-bundle.js.LICENSE.txt b/build/get-computed-value-once-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/get-computed-value-once-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/index.node.bundle.js b/build/index.node.bundle.js new file mode 100644 index 0000000..7b6dbda --- /dev/null +++ b/build/index.node.bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see index.node.bundle.js.LICENSE.txt */ +(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var a,o={function:!0,object:!0},s=o[typeof window]&&window||this,u=(n.amdD,o[typeof t]&&t&&!t.nodeType&&t),l=o.object&&e&&!e.nodeType&&e,c=u&&l&&"object"==typeof global&&global;!c||c.global!==c&&c.window!==c&&c.self!==c||(s=c);var f=0,p=(l&&l.exports,/^(?:boolean|number|string|undefined)$/),d=0,h=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],b={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||Y("lodash")||s._;if(!t)return B.runInContext=g,B;(e=e?t.defaults(s.Object(),e,t.pick(s,h)):s).Array;var r=e.Date,i=e.Function,o=e.Math,l=e.Object,c=(e.RegExp,e.String),m=[],_=l.prototype,w=o.abs,O=e.clearTimeout,j=o.floor,P=(o.log,o.max),S=o.min,x=o.pow,A=m.push,C=(e.setTimeout,m.shift),k=m.slice,T=o.sqrt,E=(_.toString,m.unshift),I=Y,N=X(e,"document")&&e.document,D=I("microtime"),R=X(e,"process")&&e.process,V=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&X(e,"navigator")&&!X(e,"phantom"),z.timeout=X(e,"setTimeout")&&X(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var Z={ns:r,start:null,stop:null};function B(e,n,r){var i=this;if(!(i instanceof B))return new B(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=W(i.stats),i.times=W(i.times)}function F(e){var t=this;if(!(t instanceof F))return new F(e);t.benchmark=e,le(t)}function U(e){return e instanceof U?e:this instanceof U?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new U(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var W=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function H(){return H=function(e,t){var r,i=n.amdD?n.amdO:B,a=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+a+"=function("+e+"){"+t+"}"),r=i[a],delete i[a],r},(H=z.browser&&(H("",'return"'+M+'"')||t.noop)()==M?H:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function G(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function q(e){var n="";return J(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function X(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function J(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function Y(e){try{var t=u&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:B,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],a=i.parentNode,o=M+"runScript",s="("+(n.amdD?"define.amd.":"Benchmark.")+o+"||function(){})();";try{r.appendChild(N.createTextNode(s+e)),t[o]=function(){var e;e=r,V.appendChild(e),V.innerHTML=""}}catch(t){a=a.cloneNode(!1),i=null,r.text=e}a.insertBefore(r,i),delete t[o]}function ee(e,n){n=e.options=t.assign({},W(e.constructor.options),W(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=W(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,o,s=-1,u={currentTarget:e},l={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,o=d(i);return o&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[s]=t.isFunction(i&&i[n])?i[n].apply(i,r):a,!o&&p()}function p(t){var n,r=i,a=d(r);if(a&&(r.off("complete",p),r.emit("complete")),u.type="cycle",u.target=r,n=U(u),l.onCycle.call(e,n),n.aborted||!1===h())u.type="complete",l.onComplete.call(e,U(u));else if(d(i=o?e[0]:c[s]))K(i,f);else{if(!a)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function d(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof B&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function h(){return s++,o&&s>0&&C.call(e),(o?e.length:s>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(o?e:t+r+e)})),i.join(n||",")}function ae(e){var n,r=this,i=U(e),a=r.events,o=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,a&&(n=t.has(a,i.type)&&a[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,o))&&(i.cancelled=!0),!i.aborted})),i.result}function oe(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function se(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var a;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(a=t.indexOf(e,n))>-1&&e.splice(a,1):e.length=0)})),r):r}function ue(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function le(){var n=B.options,r={},i=[{ns:Z.ns,res:P(.0015,o("ms")),unit:"ms"}];function a(e,n,i,a){var o=e.fn,u=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(o)||"deferred":"";return r.uid=M+d++,t.assign(r,{setup:n?q(e.setup):s("m#.setup()"),fn:n?q(o):s("m#.fn("+u+")"),fnArg:u,teardown:n?q(e.teardown):s("m#.teardown()")}),"ns"==Z.unit?t.assign(r,{begin:s("s#=n#()"),end:s("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==Z.unit?Z.ns.stop?t.assign(r,{begin:s("s#=n#.start()"),end:s("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:s("s#=n#()"),end:s("r#=(n#()-s#)/1e6")}):Z.ns.now?t.assign(r,{begin:s("s#=n#.now()"),end:s("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:s("s#=new n#().getTime()"),end:s("r#=(new n#().getTime()-s#)/1e3")}),Z.start=H(s("o#"),s("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),Z.stop=H(s("o#"),s("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),H(s("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+s(a))}function o(e){for(var t,n,r=30,i=1e3,a=Z.ns,o=[];r--;){if("us"==e)if(i=1e6,a.stop)for(a.start();!(t=a.microseconds()););else for(n=a();!(t=a()-n););else if("ns"==e){for(i=1e9,n=(n=a())[0]+n[1]/i;!(t=(t=a())[0]+t[1]/i-n););i=1}else if(a.now)for(n=a.now();!(t=a.now()-n););else for(n=(new a).getTime();!(t=(new a).getTime()-n););if(!(t>0)){o.push(1/0);break}o.push(t)}return G(o)/i}function s(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}le=function(i){var o;i instanceof F&&(i=(o=i).benchmark);var s=i._original,u=J(s.fn),l=s.count=i.count,f=u||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=s.id,d=s.name||("number"==typeof p?"":p),h=0;i.minTime=s.minTime||(s.minTime=s.options.minTime=n.minTime);var b=o?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=s.compiled=i.compiled=a(s,f,o,b),y=!(r.fn||u);try{if(y)throw new Error('The test "'+d+'" is empty. This may be the result of dead code removal.');o||(s.count=1,v=f&&(v.call(s,e,Z)||{}).uid==r.uid&&v,s.count=l)}catch(e){v=null,i.error=e||new Error(c(e)),s.count=l}if(!v&&!o&&!y){v=a(s,f,o,b=(u||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{s.count=1,v.call(s,e,Z),s.count=l,delete i.error}catch(e){s.count=l,i.error||(i.error=e||new Error(c(e)))}}return i.error||(h=(v=s.compiled=i.compiled=a(s,f,o,b)).call(o||s,e,Z).elapsed),h};try{(Z.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:Z.ns,res:o("us"),unit:"us"})}catch(e){}if(R&&"function"==typeof(Z.ns=R.hrtime)&&i.push({ns:Z.ns,res:o("ns"),unit:"ns"}),D&&"function"==typeof(Z.ns=D.now)&&i.push({ns:Z.ns,res:o("us"),unit:"us"}),(Z=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(Z.res/2/.01,.05)),le.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof F&&(r=t,t=t.benchmark);var i,a,s,u,l,c,f=n.async,p=t._original,d=t.count,h=t.times;t.running&&(a=++t.cycles,i=r?r.elapsed:le(t),l=t.minTime,a>p.cycles&&(p.cycles=a),t.error&&((u=U("error")).message=t.error,t.emit(u),u.cancelled||t.abort())),t.running&&(p.times.cycle=h.cycle=i,c=p.times.period=h.period=i/d,p.hz=t.hz=1/c,p.initCount=t.initCount=d,t.running=ie?0:n30?(n=function(e){return(e-a*o/2)/T(a*o*(a+o+1)/12)}(f),w(n)>1.96?f==l?1:-1:0):f<=(s<5||u<3?0:y[s][u-3])?f==l?1:-1:0},emit:ae,listeners:oe,off:se,on:ue,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],o=[],s={destination:e,source:t.assign({},W(e.constructor.prototype),W(e.options))};do{t.forOwn(s.source,(function(e,n){var r,u=s.destination,l=u[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(l)||(r=!0,l=[]),l.length!=e.length&&(r=!0,(l=l.slice(0,e.length)).length=e.length)):t.isObjectLike(l)||(r=!0,l={}),r&&i.push({destination:u,key:n,value:l}),o.push({destination:l,source:e})):t.eq(l,e)||e===a||i.push({destination:u,key:n,value:e}))}))}while(s=o[r++]);return i.length&&(e.emit(n=U("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=U("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?F(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,a=e.initCount,s=e.minSamples,u=[],l=e.stats.sample;function c(){u.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(u,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,d,h,b,y,g=n.target,m=e.aborted,_=t.now(),w=l.push(g.times.period),O=w>=s&&(i+=_-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(m||g.hz==1/0)&&(O=!(w=l.length=u.length=0)),m||(f=G(l),y=t.reduce(l,(function(e,t){return e+x(t-f,2)}),0)/(w-1)||0,r=w-1,d=(p=(b=(h=T(y))/T(w))*(v[o.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:h,mean:f,moe:p,rme:d,sem:b,variance:y}),O&&(e.initCount=a,e.running=!1,m=!0,j.elapsed=(_-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),u.length<2&&!O&&c(),n.aborted=m},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,a=e.stats,o=a.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+a.rme.toFixed(2)+"% ("+o+" run"+(1==o?"":"s")+" sampled)")}}),t.assign(F.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(F.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,a="Expected a function",o="__lodash_hash_undefined__",s="__lodash_placeholder__",u=32,l=128,c=1/0,f=9007199254740991,p=NaN,d=4294967295,h=[["ary",l],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",u],["partialRight",64],["rearg",256]],b="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",m="[object Error]",_="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",x="[object RegExp]",A="[object Set]",C="[object String]",k="[object Symbol]",T="[object WeakMap]",E="[object ArrayBuffer]",I="[object DataView]",N="[object Float32Array]",D="[object Float64Array]",R="[object Int8Array]",V="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",Z="[object Uint16Array]",B="[object Uint32Array]",F=/\b__p \+= '';/g,U=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,W=/&(?:amp|lt|gt|quot|#39);/g,H=/[&<>"']/g,K=RegExp(W.source),G=RegExp(H.source),q=/<%-([\s\S]+?)%>/g,X=/<%([\s\S]+?)%>/g,J=/<%=([\s\S]+?)%>/g,Y=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,ae=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,oe=/\{\n\/\* \[wrapped with (.+)\] \*/,se=/,? & /,ue=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,le=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,de=/^[-+]0x[0-9a-f]+$/i,he=/^0b[01]+$/i,be=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,me=/($^)/,_e=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",xe="\\ufe0e\\ufe0f",Ae="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ce="["+we+"]",ke="["+Ae+"]",Te="["+Oe+"]",Ee="\\d+",Ie="["+je+"]",Ne="["+Pe+"]",De="[^"+we+Ae+Ee+je+Pe+Se+"]",Re="\\ud83c[\\udffb-\\udfff]",Ve="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Ze="\\u200d",Be="(?:"+Ne+"|"+De+")",Fe="(?:"+ze+"|"+De+")",Ue="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",We="(?:"+Te+"|"+Re+")?",He="["+xe+"]?",Ke=He+We+"(?:"+Ze+"(?:"+[Ve,Me,Le].join("|")+")"+He+We+")*",Ge="(?:"+[Ie,Me,Le].join("|")+")"+Ke,qe="(?:"+[Ve+Te+"?",Te,Me,Le,Ce].join("|")+")",Xe=RegExp("['’]","g"),Je=RegExp(Te,"g"),Ye=RegExp(Re+"(?="+Re+")|"+qe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+Ue+"(?="+[ke,ze,"$"].join("|")+")",Fe+"+"+$e+"(?="+[ke,ze+Be,"$"].join("|")+")",ze+"?"+Be+"+"+Ue,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ee,Ge].join("|"),"g"),et=RegExp("["+Ze+we+Oe+xe+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[D]=it[R]=it[V]=it[M]=it[L]=it[z]=it[Z]=it[B]=!0,it[b]=it[v]=it[E]=it[y]=it[I]=it[g]=it[m]=it[_]=it[O]=it[j]=it[P]=it[x]=it[A]=it[C]=it[T]=!1;var at={};at[b]=at[v]=at[E]=at[I]=at[y]=at[g]=at[N]=at[D]=at[R]=at[V]=at[M]=at[O]=at[j]=at[P]=at[x]=at[A]=at[C]=at[k]=at[L]=at[z]=at[Z]=at[B]=!0,at[m]=at[_]=at[T]=!1;var ot={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},st=parseFloat,ut=parseInt,lt="object"==typeof global&&global&&global.Object===Object&&global,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=lt||ct||Function("return this")(),pt=t&&!t.nodeType&&t,dt=pt&&e&&!e.nodeType&&e,ht=dt&&dt.exports===pt,bt=ht&<.process,vt=function(){try{return dt&&dt.require&&dt.require("util").types||bt&&bt.binding&&bt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,mt=vt&&vt.isMap,_t=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,a=null==e?0:e.length;++i-1}function Tt(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+ot[e]}function rn(e){return et.test(e)}function an(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function on(e,t){return function(n){return e(t(n))}}function sn(e,t){for(var n=-1,r=e.length,i=0,a=[];++n",""":'"',"'":"'"}),hn=function e(t){var n,r=(t=null==t?ft:hn.defaults(ft.Object(),t,hn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,xe=t.String,Ae=t.TypeError,Ce=r.prototype,ke=Oe.prototype,Te=Pe.prototype,Ee=t["__core-js_shared__"],Ie=ke.toString,Ne=Te.hasOwnProperty,De=0,Re=(n=/[^.]+$/.exec(Ee&&Ee.keys&&Ee.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Ve=Te.toString,Me=Ie.call(Pe),Le=ft._,ze=Se("^"+Ie.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ze=ht?t.Buffer:i,Be=t.Symbol,Fe=t.Uint8Array,Ue=Ze?Ze.allocUnsafe:i,$e=on(Pe.getPrototypeOf,Pe),We=Pe.create,He=Te.propertyIsEnumerable,Ke=Ce.splice,Ge=Be?Be.isConcatSpreadable:i,qe=Be?Be.iterator:i,Ye=Be?Be.toStringTag:i,et=function(){try{var e=ua(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),ot=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,lt=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,dt=je.floor,bt=Pe.getOwnPropertySymbols,vt=Ze?Ze.isBuffer:i,Vt=t.isFinite,$t=Ce.join,bn=on(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,mn=t.parseInt,_n=je.random,wn=Ce.reverse,On=ua(t,"DataView"),jn=ua(t,"Map"),Pn=ua(t,"Promise"),Sn=ua(t,"Set"),xn=ua(t,"WeakMap"),An=ua(Pe,"create"),Cn=xn&&new xn,kn={},Tn=Va(On),En=Va(jn),In=Va(Pn),Nn=Va(Sn),Dn=Va(xn),Rn=Be?Be.prototype:i,Vn=Rn?Rn.valueOf:i,Mn=Rn?Rn.toString:i;function Ln(e){if(es(e)&&!Uo(e)&&!(e instanceof Fn)){if(e instanceof Bn)return e;if(Ne.call(e,"__wrapped__"))return Ma(e)}return new Bn(e)}var zn=function(){function e(){}return function(t){if(!Qo(t))return{};if(We)return We(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Zn(){}function Bn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Fn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=d,this.__views__=[]}function Un(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function or(e,t,n,r,a,o){var s,u=1&t,l=2&t,c=4&t;if(n&&(s=a?n(e,r,a,o):n(e)),s!==i)return s;if(!Qo(e))return e;var f=Uo(e);if(f){if(s=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!u)return xi(e,s)}else{var p=fa(e),d=p==_||p==w;if(Ko(e))return _i(e,u);if(p==P||p==b||d&&!a){if(s=l||d?{}:da(e),!u)return l?function(e,t){return Ai(e,ca(e),t)}(e,function(e,t){return e&&Ai(t,Es(t),e)}(s,e)):function(e,t){return Ai(e,la(e),t)}(e,nr(s,e))}else{if(!at[p])return a?e:{};s=function(e,t,n){var r,i=e.constructor;switch(t){case E:return wi(e);case y:case g:return new i(+e);case I:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case D:case R:case V:case M:case L:case z:case Z:case B:return Oi(e,n);case O:return new i;case j:case C:return new i(e);case x:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case A:return new i;case k:return r=e,Vn?Pe(Vn.call(r)):{}}}(e,p,u)}}o||(o=new Kn);var h=o.get(e);if(h)return h;o.set(e,s),as(e)?e.forEach((function(r){s.add(or(r,t,n,r,e,o))})):ts(e)&&e.forEach((function(r,i){s.set(i,or(r,t,n,i,e,o))}));var v=f?i:(c?l?ta:ea:l?Es:Ts)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(s,i,or(r,t,n,i,e,o))})),s}function sr(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var a=n[r],o=t[a],s=e[a];if(s===i&&!(a in e)||!o(s))return!1}return!0}function ur(e,t,n){if("function"!=typeof e)throw new Ae(a);return Aa((function(){e.apply(i,n)}),t)}function lr(e,t,n,r){var i=-1,a=kt,o=!0,s=e.length,u=[],l=t.length;if(!s)return u;n&&(t=Et(t,qt(n))),r?(a=Tt,o=!1):t.length>=200&&(a=Jt,o=!1,t=new Hn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Wn.prototype.clear=function(){this.size=0,this.__data__={hash:new Un,map:new(jn||$n),string:new Un}},Wn.prototype.delete=function(e){var t=oa(this,e).delete(e);return this.size-=t?1:0,t},Wn.prototype.get=function(e){return oa(this,e).get(e)},Wn.prototype.has=function(e){return oa(this,e).has(e)},Wn.prototype.set=function(e,t){var n=oa(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Hn.prototype.add=Hn.prototype.push=function(e){return this.__data__.set(e,o),this},Hn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Wn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ti(gr),fr=Ti(mr,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function dr(e,t,n){for(var r=-1,a=e.length;++r0&&n(s)?t>1?br(s,t-1,n,r,i):It(i,s):r||(i[i.length]=s)}return i}var vr=Ei(),yr=Ei(!0);function gr(e,t){return e&&vr(e,t,Ts)}function mr(e,t){return e&&yr(e,t,Ts)}function _r(e,t){return Ct(t,(function(t){return Xo(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function xr(e,t){return null!=e&&t in Pe(e)}function Ar(e,t,n){for(var a=n?Tt:kt,o=e[0].length,s=e.length,u=s,l=r(s),c=1/0,f=[];u--;){var p=e[u];u&&t&&(p=Et(p,qt(t))),c=yn(p.length,c),l[u]=!n&&(t||o>=120&&p.length>=120)?new Hn(u&&p):i}p=e[0];var d=-1,h=l[0];e:for(;++d=s?u:u*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Fr(e,t,n){for(var r=-1,i=t.length,a={};++r-1;)s!==e&&Ke.call(s,u,1),Ke.call(e,u,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==a){var a=i;ba(i)?Ke.call(e,i,1):ui(e,i)}}return e}function Wr(e,t){return e+dt(_n()*(t-e+1))}function Hr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=dt(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return Ca(ja(e,t,nu),e+"")}function Gr(e){return qn(zs(e))}function qr(e,t){var n=zs(e);return Ea(n,ar(t,0,n.length))}function Xr(e,t,n,r){if(!Qo(e))return e;for(var a=-1,o=(t=vi(t,e)).length,s=o-1,u=e;null!=u&&++aa?0:a+t),(n=n>a?a:n)<0&&(n+=a),a=t>n?0:n-t>>>0,t>>>=0;for(var o=r(a);++i>>1,o=e[a];null!==o&&!ss(o)&&(n?o<=t:o=200){var l=t?null:Hi(e);if(l)return un(l);o=!1,i=Jt,u=new Hn}else u=t?[]:s;e:for(;++r=r?e:ei(e,t,n)}var mi=ot||function(e){return ft.clearTimeout(e)};function _i(e,t){if(t)return e.slice();var n=e.length,r=Ue?Ue(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Fe(t).set(new Fe(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,a=e==e,o=ss(e),s=t!==i,u=null===t,l=t==t,c=ss(t);if(!u&&!c&&!o&&e>t||o&&s&&l&&!u&&!c||r&&s&&l||!n&&l||!a)return 1;if(!r&&!o&&!c&&e1?n[a-1]:i,s=a>2?n[2]:i;for(o=e.length>3&&"function"==typeof o?(a--,o):i,s&&va(n[0],n[1],s)&&(o=a<3?i:o,a=1),t=Pe(t);++r-1?a[o?t[s]:s]:i}}function Vi(e){return Qi((function(t){var n=t.length,r=n,o=Bn.prototype.thru;for(e&&t.reverse();r--;){var s=t[r];if("function"!=typeof s)throw new Ae(a);if(o&&!u&&"wrapper"==ra(s))var u=new Bn([],!0)}for(r=u?r:n;++r1&&_.reverse(),d&&fu))return!1;var c=o.get(e),f=o.get(t);if(c&&f)return c==t&&f==e;var p=-1,d=!0,h=2&n?new Hn:i;for(o.set(e,t),o.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(ae,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(h,(function(n){var r="_."+n[0];t&n[1]&&!kt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(oe);return t?t[1].split(se):[]}(r),n)))}function Ta(e){var t=0,n=0;return function(){var r=gn(),a=16-(r-n);if(n=r,a>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function Ea(e,t){var n=-1,r=e.length,a=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ro(e,n)}));function co(e){var t=Ln(e);return t.__chain__=!0,t}function fo(e,t){return t(e)}var po=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,a=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Fn&&ba(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:fo,args:[a],thisArg:i}),new Bn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(a)})),ho=Ci((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),bo=Ri(Ba),vo=Ri(Fa);function yo(e,t){return(Uo(e)?St:cr)(e,aa(t,3))}function go(e,t){return(Uo(e)?xt:fr)(e,aa(t,3))}var mo=Ci((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),_o=Kr((function(e,t,n){var i=-1,a="function"==typeof t,o=Wo(e)?r(e.length):[];return cr(e,(function(e){o[++i]=a?jt(t,e,n):Cr(e,t,n)})),o})),wo=Ci((function(e,t,n){rr(e,n,t)}));function Oo(e,t){return(Uo(e)?Et:Vr)(e,aa(t,3))}var jo=Ci((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Po=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&va(e,t[0],t[1])?t=[]:n>2&&va(t[0],t[1],t[2])&&(t=[t[0]]),Br(e,br(t,1),[])})),So=lt||function(){return ft.Date.now()};function xo(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,Gi(e,l,i,i,i,i,t)}function Ao(e,t){var n;if("function"!=typeof t)throw new Ae(a);return e=ds(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Co=Kr((function(e,t,n){var r=1;if(n.length){var i=sn(n,ia(Co));r|=u}return Gi(e,r,t,n,i)})),ko=Kr((function(e,t,n){var r=3;if(n.length){var i=sn(n,ia(ko));r|=u}return Gi(t,r,e,n,i)}));function To(e,t,n){var r,o,s,u,l,c,f=0,p=!1,d=!1,h=!0;if("function"!=typeof e)throw new Ae(a);function b(t){var n=r,a=o;return r=o=i,f=t,u=e.apply(a,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||d&&e-f>=s}function y(){var e=So();if(v(e))return g(e);l=Aa(y,function(e){var n=t-(e-c);return d?yn(n,s-(e-f)):n}(e))}function g(e){return l=i,h&&r?b(e):(r=o=i,u)}function m(){var e=So(),n=v(e);if(r=arguments,o=this,c=e,n){if(l===i)return function(e){return f=e,l=Aa(y,t),p?b(e):u}(c);if(d)return mi(l),l=Aa(y,t),b(c)}return l===i&&(l=Aa(y,t)),u}return t=bs(t)||0,Qo(n)&&(p=!!n.leading,s=(d="maxWait"in n)?vn(bs(n.maxWait)||0,t):s,h="trailing"in n?!!n.trailing:h),m.cancel=function(){l!==i&&mi(l),f=0,r=c=o=l=i},m.flush=function(){return l===i?u:g(So())},m}var Eo=Kr((function(e,t){return ur(e,1,t)})),Io=Kr((function(e,t,n){return ur(e,bs(t)||0,n)}));function No(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Ae(a);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(No.Cache||Wn),n}function Do(e){if("function"!=typeof e)throw new Ae(a);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}No.Cache=Wn;var Ro=yi((function(e,t){var n=(t=1==t.length&&Uo(t[0])?Et(t[0],qt(aa())):Et(br(t,1),qt(aa()))).length;return Kr((function(r){for(var i=-1,a=yn(r.length,n);++i=t})),Fo=kr(function(){return arguments}())?kr:function(e){return es(e)&&Ne.call(e,"callee")&&!He.call(e,"callee")},Uo=r.isArray,$o=yt?qt(yt):function(e){return es(e)&&jr(e)==E};function Wo(e){return null!=e&&Yo(e.length)&&!Xo(e)}function Ho(e){return es(e)&&Wo(e)}var Ko=vt||bu,Go=gt?qt(gt):function(e){return es(e)&&jr(e)==g};function qo(e){if(!es(e))return!1;var t=jr(e);return t==m||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!rs(e)}function Xo(e){if(!Qo(e))return!1;var t=jr(e);return t==_||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Jo(e){return"number"==typeof e&&e==ds(e)}function Yo(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qo(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function es(e){return null!=e&&"object"==typeof e}var ts=mt?qt(mt):function(e){return es(e)&&fa(e)==O};function ns(e){return"number"==typeof e||es(e)&&jr(e)==j}function rs(e){if(!es(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Ie.call(n)==Me}var is=_t?qt(_t):function(e){return es(e)&&jr(e)==x},as=wt?qt(wt):function(e){return es(e)&&fa(e)==A};function os(e){return"string"==typeof e||!Uo(e)&&es(e)&&jr(e)==C}function ss(e){return"symbol"==typeof e||es(e)&&jr(e)==k}var us=Ot?qt(Ot):function(e){return es(e)&&Yo(e.length)&&!!it[jr(e)]},ls=Ui(Rr),cs=Ui((function(e,t){return e<=t}));function fs(e){if(!e)return[];if(Wo(e))return os(e)?fn(e):xi(e);if(qe&&e[qe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[qe]());var t=fa(e);return(t==O?an:t==A?un:zs)(e)}function ps(e){return e?(e=bs(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function ds(e){var t=ps(e),n=t%1;return t==t?n?t-n:t:0}function hs(e){return e?ar(ds(e),0,d):0}function bs(e){if("number"==typeof e)return e;if(ss(e))return p;if(Qo(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qo(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Gt(e);var n=he.test(e);return n||ve.test(e)?ut(e.slice(2),n?2:8):de.test(e)?p:+e}function vs(e){return Ai(e,Es(e))}function ys(e){return null==e?"":oi(e)}var gs=ki((function(e,t){if(_a(t)||Wo(t))Ai(t,Ts(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),ms=ki((function(e,t){Ai(t,Es(t),e)})),_s=ki((function(e,t,n,r){Ai(t,Es(t),e,r)})),ws=ki((function(e,t,n,r){Ai(t,Ts(t),e,r)})),Os=Qi(ir),js=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,a=r>2?t[2]:i;for(a&&va(t[0],t[1],a)&&(r=1);++n1),t})),Ai(e,ta(e),n),r&&(n=or(n,7,Ji));for(var i=t.length;i--;)ui(n,t[i]);return n})),Rs=Qi((function(e,t){return null==e?{}:function(e,t){return Fr(e,t,(function(t,n){return xs(e,n)}))}(e,t)}));function Vs(e,t){if(null==e)return{};var n=Et(ta(e),(function(e){return[e]}));return t=aa(t),Fr(e,n,(function(e,n){return t(e,n[0])}))}var Ms=Ki(Ts),Ls=Ki(Es);function zs(e){return null==e?[]:Xt(e,Ts(e))}var Zs=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Bs(t):t)}));function Bs(e){return qs(ys(e).toLowerCase())}function Fs(e){return(e=ys(e))&&e.replace(ge,en).replace(Je,"")}var Us=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$s=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Ws=Ii("toLowerCase"),Hs=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ks=Ni((function(e,t,n){return e+(n?" ":"")+qs(t)})),Gs=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),qs=Ii("toUpperCase");function Xs(e,t,n){return e=ys(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(ue)||[]}(e):e.match(t)||[]}var Js=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return qo(e)?e:new we(e)}})),Ys=Qi((function(e,t){return St(t,(function(t){t=Ra(t),rr(e,t,Co(e[t],e))})),e}));function Qs(e){return function(){return e}}var eu=Vi(),tu=Vi(!0);function nu(e){return e}function ru(e){return Nr("function"==typeof e?e:or(e,1))}var iu=Kr((function(e,t){return function(n){return Cr(n,e,t)}})),au=Kr((function(e,t){return function(n){return Cr(e,n,t)}}));function ou(e,t,n){var r=Ts(t),i=_r(t,r);null!=n||Qo(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=_r(t,Ts(t)));var a=!(Qo(n)&&"chain"in n&&!n.chain),o=Xo(e);return St(i,(function(n){var r=t[n];e[n]=r,o&&(e.prototype[n]=function(){var t=this.__chain__;if(a||t){var n=e(this.__wrapped__);return(n.__actions__=xi(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,It([this.value()],arguments))})})),e}function su(){}var uu=Zi(Et),lu=Zi(At),cu=Zi(Rt);function fu(e){return ya(e)?Ut(Ra(e)):function(e){return function(t){return wr(t,e)}}(e)}var pu=Fi(),du=Fi(!0);function hu(){return[]}function bu(){return!1}var vu,yu=zi((function(e,t){return e+t}),0),gu=Wi("ceil"),mu=zi((function(e,t){return e/t}),1),_u=Wi("floor"),wu=zi((function(e,t){return e*t}),1),Ou=Wi("round"),ju=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new Ae(a);return e=ds(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=xo,Ln.assign=gs,Ln.assignIn=ms,Ln.assignInWith=_s,Ln.assignWith=ws,Ln.at=Os,Ln.before=Ao,Ln.bind=Co,Ln.bindAll=Ys,Ln.bindKey=ko,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Uo(e)?e:[e]},Ln.chain=co,Ln.chunk=function(e,t,n){t=(n?va(e,t,n):t===i)?1:vn(ds(t),0);var a=null==e?0:e.length;if(!a||t<1)return[];for(var o=0,s=0,u=r(pt(a/t));oa?0:a+n),(r=r===i||r>a?a:ds(r))<0&&(r+=a),r=n>r?0:hs(r);n>>0)?(e=ys(e))&&("string"==typeof t||null!=t&&!is(t))&&!(t=oi(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new Ae(a);return t=null==t?0:vn(ds(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&It(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:ds(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:ds(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,aa(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,aa(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new Ae(a);return Qo(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),To(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=fo,Ln.toArray=fs,Ln.toPairs=Ms,Ln.toPairsIn=Ls,Ln.toPath=function(e){return Uo(e)?Et(e,Ra):ss(e)?[e]:xi(Da(ys(e)))},Ln.toPlainObject=vs,Ln.transform=function(e,t,n){var r=Uo(e),i=r||Ko(e)||us(e);if(t=aa(t,4),null==n){var a=e&&e.constructor;n=i?r?new a:[]:Qo(e)&&Xo(a)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return xo(e,1)},Ln.union=Qa,Ln.unionBy=eo,Ln.unionWith=to,Ln.uniq=function(e){return e&&e.length?si(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?si(e,aa(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?si(e,i,t):[]},Ln.unset=function(e,t){return null==e||ui(e,t)},Ln.unzip=no,Ln.unzipWith=ro,Ln.update=function(e,t,n){return null==e?e:li(e,t,bi(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:li(e,t,bi(n),r)},Ln.values=zs,Ln.valuesIn=function(e){return null==e?[]:Xt(e,Es(e))},Ln.without=io,Ln.words=Xs,Ln.wrap=function(e,t){return Vo(bi(t),e)},Ln.xor=ao,Ln.xorBy=oo,Ln.xorWith=so,Ln.zip=uo,Ln.zipObject=function(e,t){return di(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return di(e||[],t||[],Xr)},Ln.zipWith=lo,Ln.entries=Ms,Ln.entriesIn=Ls,Ln.extend=ms,Ln.extendWith=_s,ou(Ln,Ln),Ln.add=yu,Ln.attempt=Js,Ln.camelCase=Zs,Ln.capitalize=Bs,Ln.ceil=gu,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=bs(n))==n?n:0),t!==i&&(t=(t=bs(t))==t?t:0),ar(bs(e),t,n)},Ln.clone=function(e){return or(e,4)},Ln.cloneDeep=function(e){return or(e,5)},Ln.cloneDeepWith=function(e,t){return or(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return or(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||sr(e,t,Ts(t))},Ln.deburr=Fs,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=mu,Ln.endsWith=function(e,t,n){e=ys(e),t=oi(t);var r=e.length,a=n=n===i?r:ar(ds(n),0,r);return(n-=t.length)>=0&&e.slice(n,a)==t},Ln.eq=zo,Ln.escape=function(e){return(e=ys(e))&&G.test(e)?e.replace(H,tn):e},Ln.escapeRegExp=function(e){return(e=ys(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Uo(e)?At:pr;return n&&va(e,t,n)&&(t=i),r(e,aa(t,3))},Ln.find=bo,Ln.findIndex=Ba,Ln.findKey=function(e,t){return Mt(e,aa(t,3),gr)},Ln.findLast=vo,Ln.findLastIndex=Fa,Ln.findLastKey=function(e,t){return Mt(e,aa(t,3),mr)},Ln.floor=_u,Ln.forEach=yo,Ln.forEachRight=go,Ln.forIn=function(e,t){return null==e?e:vr(e,aa(t,3),Es)},Ln.forInRight=function(e,t){return null==e?e:yr(e,aa(t,3),Es)},Ln.forOwn=function(e,t){return e&&gr(e,aa(t,3))},Ln.forOwnRight=function(e,t){return e&&mr(e,aa(t,3))},Ln.get=Ss,Ln.gt=Zo,Ln.gte=Bo,Ln.has=function(e,t){return null!=e&&pa(e,t,Sr)},Ln.hasIn=xs,Ln.head=$a,Ln.identity=nu,Ln.includes=function(e,t,n,r){e=Wo(e)?e:zs(e),n=n&&!r?ds(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),os(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:ds(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=ps(t),n===i?(n=t,t=0):n=ps(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=as,Ln.isString=os,Ln.isSymbol=ss,Ln.isTypedArray=us,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return es(e)&&fa(e)==T},Ln.isWeakSet=function(e){return es(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Us,Ln.last=Ga,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var a=r;return n!==i&&(a=(a=ds(n))<0?vn(r+a,0):yn(a,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,a):Lt(e,Bt,a,!0)},Ln.lowerCase=$s,Ln.lowerFirst=Ws,Ln.lt=ls,Ln.lte=cs,Ln.max=function(e){return e&&e.length?dr(e,nu,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?dr(e,aa(t,2),Pr):i},Ln.mean=function(e){return Ft(e,nu)},Ln.meanBy=function(e,t){return Ft(e,aa(t,2))},Ln.min=function(e){return e&&e.length?dr(e,nu,Rr):i},Ln.minBy=function(e,t){return e&&e.length?dr(e,aa(t,2),Rr):i},Ln.stubArray=hu,Ln.stubFalse=bu,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wu,Ln.nth=function(e,t){return e&&e.length?Zr(e,ds(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=su,Ln.now=So,Ln.pad=function(e,t,n){e=ys(e);var r=(t=ds(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Bi(dt(i),n)+e+Bi(pt(i),n)},Ln.padEnd=function(e,t,n){e=ys(e);var r=(t=ds(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var a=_n();return yn(e+a*(t-e+st("1e-"+((a+"").length-1))),t)}return Wr(e,t)},Ln.reduce=function(e,t,n){var r=Uo(e)?Nt:Wt,i=arguments.length<3;return r(e,aa(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Uo(e)?Dt:Wt,i=arguments.length<3;return r(e,aa(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?va(e,t,n):t===i)?1:ds(t),Hr(ys(e),t)},Ln.replace=function(){var e=arguments,t=ys(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,a=(t=vi(t,e)).length;for(a||(a=1,e=i);++rf)return[];var n=d,r=yn(e,d);t=aa(t),e-=d;for(var i=Kt(r,t);++n=o)return e;var u=n-cn(r);if(u<1)return r;var l=s?gi(s,0,u).join(""):e.slice(0,u);if(a===i)return l+r;if(s&&(u+=l.length-u),is(a)){if(e.slice(u).search(a)){var c,f=l;for(a.global||(a=Se(a.source,ys(pe.exec(a))+"g")),a.lastIndex=0;c=a.exec(f);)var p=c.index;l=l.slice(0,p===i?u:p)}}else if(e.indexOf(oi(a),u)!=u){var d=l.lastIndexOf(a);d>-1&&(l=l.slice(0,d))}return l+r},Ln.unescape=function(e){return(e=ys(e))&&K.test(e)?e.replace(W,dn):e},Ln.uniqueId=function(e){var t=++De;return ys(e)+t},Ln.upperCase=Gs,Ln.upperFirst=qs,Ln.each=yo,Ln.eachRight=go,Ln.first=$a,ou(Ln,(vu={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vu[t]=e)})),vu),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Fn.prototype[e]=function(n){n=n===i?1:vn(ds(n),0);var r=this.__filtered__&&!t?new Fn(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,d),type:e+(r.__dir__<0?"Right":"")}),r},Fn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Fn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:aa(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Fn.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Fn.prototype[e]=function(){return this.__filtered__?new Fn(this):this[n](1)}})),Fn.prototype.compact=function(){return this.filter(nu)},Fn.prototype.find=function(e){return this.filter(e).head()},Fn.prototype.findLast=function(e){return this.reverse().find(e)},Fn.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Fn(this):this.map((function(n){return Cr(n,e,t)}))})),Fn.prototype.reject=function(e){return this.filter(Do(aa(e)))},Fn.prototype.slice=function(e,t){e=ds(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Fn(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=ds(t))<0?n.dropRight(-t):n.take(t-e)),n)},Fn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Fn.prototype.toArray=function(){return this.take(d)},gr(Fn.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),a=Ln[r?"take"+("last"==t?"Right":""):t],o=r||/^find/.test(t);a&&(Ln.prototype[t]=function(){var t=this.__wrapped__,s=r?[1]:arguments,u=t instanceof Fn,l=s[0],c=u||Uo(t),f=function(e){var t=a.apply(Ln,It([e],s));return r&&p?t[0]:t};c&&n&&"function"==typeof l&&1!=l.length&&(u=c=!1);var p=this.__chain__,d=!!this.__actions__.length,h=o&&!p,b=u&&!d;if(!o&&c){t=b?t:new Fn(this);var v=e.apply(t,s);return v.__actions__.push({func:fo,args:[f],thisArg:i}),new Bn(v,p)}return h&&b?e.apply(this,s):(v=this.thru(f),h?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ce[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Uo(i)?i:[],e)}return this[n]((function(n){return t.apply(Uo(n)?n:[],e)}))}})),gr(Fn.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(kn,r)||(kn[r]=[]),kn[r].push({name:t,func:n})}})),kn[Mi(i,2).name]=[{name:"wrapper",func:i}],Fn.prototype.clone=function(){var e=new Fn(this.__wrapped__);return e.__actions__=xi(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=xi(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=xi(this.__views__),e},Fn.prototype.reverse=function(){if(this.__filtered__){var e=new Fn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Fn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Uo(e),r=t<0,i=n?e.length:0,a=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Zn;){var r=Ma(n);r.__index__=0,r.__values__=i,t?a.__wrapped__=r:t=r;var a=r;n=n.__wrapped__}return a.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Fn){var t=e;return this.__actions__.length&&(t=new Fn(this)),(t=t.reverse()).__actions__.push({func:fo,args:[Ya],thisArg:i}),new Bn(t,this.__chain__)}return this.thru(Ya)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,qe&&(Ln.prototype[qe]=function(){return this}),Ln}();ft._=hn,(r=function(){return hn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},a=i[typeof window]&&window||this,o=i[typeof t]&&t,s=i.object&&e&&!e.nodeType&&e,u=o&&s&&"object"==typeof global&&global;!u||u.global!==u&&u.window!==u&&u.self!==u||(a=u);var l=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,d=f.toString;function h(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function b(e){return e=_(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:h(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?h(e):d.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function m(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=l)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==F?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[s]),"IE"==z&&(s=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",F="Windows Phone "+(/\+$/.test(s)?s:s+".x"),D.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",F="Windows Phone 8.x",D.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(s=/\brv:([\d.]+)/.exec(t))&&(z&&D.push("identifying as "+z+(M?" "+M:"")),z="IE",M=s[1]),V){if(f="global",p=null!=(l=n)?typeof l[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!l[f])y(s=n.runtime)==O?(z="Adobe AIR",F=s.flash.system.Capabilities.os):y(s=n.phantom)==S?(z="PhantomJS",M=(s=s.version||null)&&s.major+"."+s.minor+"."+s.patch):"number"==typeof T.documentMode&&(s=/\bTrident\/(\d+)/i.exec(t))?(M=[M,T.documentMode],(s=+s[1]+4)!=M[1]&&(D.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=s),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof T.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(D.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],F="Windows");else if(x&&(N=(s=x.lang.System).getProperty("os.arch"),F=F||s.getProperty("os.name")+" "+s.getProperty("os.version")),A){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(s=n.system)&&s.global.system==n.system&&(z="Narwhal",F||(F=s[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(s=n.process)&&("object"==typeof s.versions&&("string"==typeof s.versions.electron?(D.push("Node "+s.versions.node),z="Electron",M=s.versions.electron):"string"==typeof s.versions.nw&&(D.push("Chromium "+M,"Node "+s.versions.node),z="NW.js",M=s.versions.nw)),z||(z="Node.js",N=s.arch,F=s.platform,M=(M=/[\d.]+/.exec(s.version))?M[0]:null));F=F&&b(F)}if(M&&(s=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(V&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(R=/b/i.test(s)?"beta":"alpha",M=M.replace(RegExp(s+"\\+?$"),"")+("beta"==R?k:C)+(/\d+\+?/.exec(s)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(F))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(Z))"Xbox 360"==Z&&(F=null),"Xbox 360"==Z&&/\bIEMobile\b/.test(t)&&D.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||Z||/Browser|Mobi/.test(z))||"Windows CE"!=F&&!/Mobi/i.test(t))if("IE"==z&&V)try{null===n.external&&D.unshift("platform preview")}catch(e){D.unshift("embedded")}else(/\bBlackBerry\b/.test(Z)||/\bBB10\b/.test(t))&&(s=(RegExp(Z.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(F=((s=[s,/BB10/.test(t)])[1]?(Z=null,B="BlackBerry"):"Device Software")+" "+s[0],M=null):this!=v&&"Wii"!=Z&&(V&&E||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(F)||"IE"==z&&(F&&!/^Win/.test(F)&&M>5.5||/\bWindows XP\b/.test(F)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(s=e.call(v,t.replace(c,"")+";"))&&s.name&&(s="ing as "+s.name+((s=s.version)?" "+s:""),c.test(z)?(/\bIE\b/.test(s)&&"Mac OS"==F&&(F=null),s="identify"+s):(s="mask"+s,z=I?b(I.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(s)&&(F=null),V||(M=null)),L=["Presto"],D.push(s));else z+=" Mobile";(s=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(s=[parseFloat(s.replace(/\.(\d)$/,".0$1")),s],"Safari"==z&&"+"==s[1].slice(-1)?(z="WebKit Nightly",R="alpha",M=s[1].slice(0,-1)):M!=s[1]&&M!=(s[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),s[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==s[0]&&537.36==s[2]&&parseFloat(s[1])>=28&&"WebKit"==L&&(L=["Blink"]),V&&(h||s[1])?(L&&(L[1]="like Chrome"),s=s[1]||((s=s[0])<530?1:s<532?2:s<532.05?3:s<533?4:s<534.03?5:s<534.07?6:s<534.1?7:s<534.13?8:s<534.16?9:s<534.24?10:s<534.3?11:s<535.01?12:s<535.02?"13+":s<535.07?15:s<535.11?16:s<535.19?17:s<536.05?18:s<536.1?19:s<537.01?20:s<537.11?"21+":s<537.13?23:s<537.18?24:s<537.24?25:s<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),s=(s=s[0])<400?1:s<500?2:s<526?3:s<533?4:s<534?"4+":s<535?5:s<537?6:s<538?7:s<601?8:s<602?9:s<604?10:s<606?11:s<608?12:"12"),L&&(L[1]+=" "+(s+="number"==typeof s?".x":/[.+]/.test(s)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=s:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&D.unshift("headless")),"Opera"==z&&(s=/\bzbov|zvav$/.exec(F))?(z+=" ",D.unshift("desktop mode"),"zvav"==s?(z+="Mini",M=null):z+="Mobile",F=F.replace(RegExp(" *"+s+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(D.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(F)?(B="Apple",F="iOS 4.3+"):F=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(s=/[\d.]+$/.exec(F))&&t.indexOf("/"+s+"-")>-1&&(F=_(F.replace(s,""))),F&&-1!=F.indexOf(z)&&!RegExp(z+" OS").test(F)&&(F=F.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(F)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(s=L[L.length-1])&&D.push(s),D.length&&(D=["("+D.join("; ")+")"]),B&&Z&&Z.indexOf(B)<0&&D.push("on "+B),Z&&D.push((/^on /.test(D[D.length-1])?"":"on ")+Z),F&&(s=/ ([\d.+]+)$/.exec(F),u=s&&"/"==F.charAt(F.length-s[0].length-1),F={architecture:32,family:s&&!u?F.replace(s[0],""):F,version:s?s[1]:null,toString:function(){var e=this.version;return this.family+(e&&!u?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(s=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(F&&(F.architecture=64,F.family=F.family.replace(RegExp(" *"+s),"")),z&&(/\bWOW64\b/i.test(t)||V&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&D.unshift("32-bit")):F&&/^OS X/.test(F.family)&&"Chrome"==z&&parseFloat(M)>=39&&(F.architecture=64),t||(t=null);var W={};return W.description=t,W.layout=L&&L[0],W.manufacturer=B,W.name=z,W.prerelease=R,W.product=Z,W.ua=t,W.version=z&&M,W.os=F||{architecture:null,family:null,version:null,toString:function(){return"null"}},W.parse=e,W.toString=function(){return this.description||""},W.version&&D.unshift(M),W.name&&D.unshift(z),F&&z&&(F!=String(F).split(" ")[0]||F!=z.split(" ")[0]&&!Z)&&D.push(Z?"("+F+")":"on "+F),D.length&&(W.description=D.join(" ")),W}();a.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var a=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.loaded=!0,a.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{"use strict";var e={};function t(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;rsu,scenario10:()=>vu,scenario11:()=>yu,scenario12:()=>gu,scenario13:()=>mu,scenario14:()=>_u,scenario15:()=>wu,scenario16:()=>Ou,scenario17:()=>ju,scenario18:()=>Pu,scenario19:()=>Su,scenario2:()=>uu,scenario20:()=>xu,scenario21:()=>Au,scenario22:()=>Cu,scenario23:()=>ku,scenario24:()=>Tu,scenario25:()=>Eu,scenario26:()=>Iu,scenario27:()=>Nu,scenario28:()=>Du,scenario29:()=>Ru,scenario3:()=>lu,scenario30:()=>Vu,scenario31:()=>Mu,scenario32:()=>Lu,scenario33:()=>zu,scenario34:()=>Zu,scenario35:()=>Bu,scenario36:()=>Fu,scenario37:()=>Uu,scenario38:()=>$u,scenario39:()=>Wu,scenario4:()=>cu,scenario40:()=>Hu,scenario41:()=>Ku,scenario42:()=>Gu,scenario43:()=>qu,scenario44:()=>Xu,scenario45:()=>Ju,scenario46:()=>Yu,scenario47:()=>Qu,scenario48:()=>el,scenario49:()=>tl,scenario5:()=>fu,scenario50:()=>nl,scenario51:()=>rl,scenario52:()=>il,scenario53:()=>al,scenario54:()=>ol,scenario55:()=>sl,scenario56:()=>ul,scenario57:()=>ll,scenario58:()=>cl,scenario59:()=>fl,scenario6:()=>pu,scenario60:()=>pl,scenario61:()=>dl,scenario62:()=>hl,scenario63:()=>bl,scenario64:()=>vl,scenario65:()=>yl,scenario66:()=>gl,scenario67:()=>ml,scenario68:()=>_l,scenario69:()=>wl,scenario7:()=>du,scenario70:()=>Ol,scenario71:()=>jl,scenario72:()=>Pl,scenario73:()=>Sl,scenario74:()=>xl,scenario8:()=>hu,scenario9:()=>bu});var r={};function i(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:r}var a=Object.assign,o=Object.getOwnPropertyDescriptor,s=Object.defineProperty,u=Object.prototype,l=[];Object.freeze(l);var c={};Object.freeze(c);var f="undefined"!=typeof Proxy,p=Object.toString();function d(){f||t("Proxy not available")}function h(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var b=function(){};function v(e){return"function"==typeof e}function y(e){switch(typeof e){case"string":case"symbol":case"number":return!0}return!1}function g(e){return null!==e&&"object"==typeof e}function m(e){if(!g(e))return!1;var t=Object.getPrototypeOf(e);if(null==t)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n.toString()===p}function _(e){var t=null==e?void 0:e.constructor;return!!t&&("GeneratorFunction"===t.name||"GeneratorFunction"===t.displayName)}function w(e,t,n){s(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function O(e,t,n){s(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function j(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(e){return g(e)&&!0===e[n]}}function P(e){return e instanceof Map}function S(e){return e instanceof Set}var x=void 0!==Object.getOwnPropertySymbols,A="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:x?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function C(e){return null===e?null:"object"==typeof e?""+e:e}function k(e,t){return u.hasOwnProperty.call(e,t)}var T=Object.getOwnPropertyDescriptors||function(e){var t={};return A(e).forEach((function(n){t[n]=o(e,n)})),t};function E(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function Z(e){return Object.assign((function(t,n){B(t,n,e)}),e)}function B(e,t,n){k(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===q}(n)||(e[z][t]=n)}var F=Symbol("mobx administration"),U=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=st.inBatch?st.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return dt(this)},t.reportChanged=function(){st.inBatch&&this.batchId_===st.batchId||(st.stateVersion=st.stateVersionr&&(r=s.dependenciesState_)}for(n.length=i,e.newObserving_=null,a=t.length;a--;){var u=t[a];0===u.diffValue_&<(u,e),u.diffValue_=0}for(;i--;){var l=n[i];1===l.diffValue_&&(l.diffValue_=0,ut(l,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Ye(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)lt(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=st.trackingDerivation;return st.trackingDerivation=null,e}function tt(e){st.trackingDerivation=e}function nt(e){var t=st.allowStateReads;return st.allowStateReads=e,t}function rt(e){st.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,st=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){t(35)}),1),new at)}();function ut(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,st.pendingUnobservations.push(e))}function ft(){0===st.inBatch&&(st.batchId=st.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var bt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=We.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,st.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=st.trackingContext;if(st.trackingContext=this,Xe(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}st.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=st.trackingContext;st.trackingContext=this;var n=Je(this,e,void 0);st.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ye(this),qe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(st.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";st.suppressReactionErrors||console.error(n,e),st.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ye(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[F]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){st.inBatch>0||st.isRunningReactions||yt(mt)}function mt(){st.isRunningReactions=!0;for(var e=st.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Ve(t,n,e):y(n)?B(t,n,e?St:jt):y(t)?Z(X(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Ct=At(!1);Object.assign(Ct,jt);var kt=At(!0);function Tt(e){return Me(e.name,!1,e,this,void 0)}function Et(e){return v(e)&&!0===e.isMobxAction}function It(e,t){var n,r,i,a,o;void 0===t&&(t=c);var s,u=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;s=new bt(u,(function(){f||(f=!0,l((function(){f=!1,s.isDisposed_||s.track(p)})))}),t.onError,t.requiresObservable)}else s=new bt(u,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(s)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||s.schedule_(),s.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(kt,St),Ct.bound=Z(Pt),kt.bound=Z(xt);var Nt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Rt="onBO",Vt="onBUO";function Mt(e,t,n){return Lt(Vt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),a=v(r)?r:n,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Zt(){this.message="FLOW_CANCELLED"}Zt.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ut=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,a=Ct(r+" - runid: "+i+" - init",n).apply(this,t),o=void 0,s=new Promise((function(t,n){var s=0;function u(e){var t;o=void 0;try{t=Ct(r+" - runid: "+i+" - yield "+s++,a.next).call(a,e)}catch(e){return n(e)}c(t)}function l(e){var t;o=void 0;try{t=Ct(r+" - runid: "+i+" - yield "+s++,a.throw).call(a,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(u,l);e.then(c,n)}e=n,u(void 0)}));return s.cancel=Ct(r+" - runid: "+i+" - cancel",(function(){try{o&&$t(o);var t=a.return(void 0),n=Promise.resolve(t.value);n.then(b,b),$t(n),e(new Zt)}catch(t){e(t)}})),s};return i.isMobXFlow=!0,i}),Bt);function $t(e){v(e.cancel)&&e.cancel()}function Wt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Ht(e,t,n){var r;return In(e)||Sn(e)||Ue(e)?r=nr(e):Fn(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function Gt(e){return function(e,t){return!!e&&(void 0!==t?!!Fn(e)&&e[F].values_.has(t):Fn(e)||!!e[F]||$(e)||_t(e)||Ke(e))}(e)}function qt(e){return Fn(e)?e[F].keys_():In(e)||Rn(e)?Array.from(e.keys()):Sn(e)?e.map((function(e,t){return t})):void t(5)}function Xt(e){return Fn(e)?qt(e).map((function(t){return e[t]})):In(e)?qt(e).map((function(t){return e.get(t)})):Rn(e)?Array.from(e.values()):Sn(e)?e.slice():void t(6)}function Jt(e,n,r){if(2!==arguments.length||Rn(e))Fn(e)?e[F].set_(n,r):In(e)?e.set(n,r):Rn(e)?e.add(n):Sn(e)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&t("Invalid index: '"+n+"'"),ft(),n>=e.length&&(e.length=n+1),e[n]=r,pt()):t(8);else{ft();var i=n;try{for(var a in i)Jt(e,a,i[a])}finally{pt()}}}function Yt(e,n,r){if(Fn(e))return e[F].defineProperty_(n,r);t(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(n,a){var o,s=nn(e,n,N({},t,{onError:a}));r=function(){s(),a(new Error("WHEN_CANCELLED"))},i=function(){s(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=r,a}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var a=Ve("When-effect",t),o=It((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),a())}),n);return o}function rn(e){return e[F]}Ut.bound=Z(Ft);var an={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(e){t(13)}};function on(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function sn(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),h((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function un(e,n){var r=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),h((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,a=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return sn(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&t("Out of range: "+e);var n=this.values_.length;if(e!==n)if(e>n){for(var r=new Array(e-n),i=0;i0&&Qn(e+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=l),on(this)){var a=un(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!a)return l;t=a.removedCount,n=a.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var o=n.length-t;this.updateArrayLength_(i,o)}var s=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,s),this.dehanceValues_(s)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(e,n){var r=this.values_;if(this.legacyMode_&&e>r.length&&t(17,e,r.length),e2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function mn(e){return function(){var t=this[F];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function _n(e){return function(t,n){var r=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[F];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",mn),gn("flat",mn),gn("includes",mn),gn("indexOf",mn),gn("join",mn),gn("lastIndexOf",mn),gn("slice",mn),gn("toString",mn),gn("toLocaleString",mn),gn("every",_n),gn("filter",_n),gn("find",_n),gn("findIndex",_n),gn("flatMap",_n),gn("forEach",_n),gn("map",_n),gn("some",_n),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",bn);function Sn(e){return g(e)&&Pn(e[F])}var xn={},An="add",Cn="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var kn,Tn,En=function(){function e(e,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=xn,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||t(18),ir((function(){i.keysAtom_=W("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var n=e.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!st.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Fe(this.has_(e),G,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(on(this)){var r=un(this,{type:n?dn:An,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,on(this)&&!un(this,{type:Cn,object:this,name:e}))return!1;if(this.has_(e)){var n=ln(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:Cn,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==st.UNCHANGED){var r=ln(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:dn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Fe(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=ln(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:An,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return lr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return lr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,a=i[0],o=i[1];e.call(t,o,a,this)}},n.merge=function(e){var n=this;return In(e)&&(e=new Map(e)),en((function(){m(e)?function(e){var t=Object.keys(e);if(!x)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return u.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(t){return n.set(t,e[t])})):Array.isArray(e)?e.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(e)?(e.constructor!==Map&&t(19,e),e.forEach((function(e,t){return n.set(t,e)}))):null!=e&&t(20,e)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(e){var n=this;return en((function(){for(var r,i=function(e){if(P(e)||In(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var n=new Map;for(var r in e)n.set(r,e[r]);return n}return t(21,e)}(e),a=new Map,o=!1,s=L(n.data_.keys());!(r=s()).done;){var u=r.value;if(!i.has(u))if(n.delete(u))o=!0;else{var l=n.data_.get(u);a.set(u,l)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,d=p[0],h=p[1],b=n.data_.has(d);if(n.set(d,h),n.data_.has(d)){var v=n.data_.get(d);a.set(d,v),b||(o=!0)}}if(!o)if(n.data_.size!==a.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){n.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}n.data_=a})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return sn(this,e)},I(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),e}(),In=j("ObservableMap",En),Nn={};kn=Symbol.iterator,Tn=Symbol.toStringTag;var Dn=function(){function e(e,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[F]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||t(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=W(i.name_),e&&i.replace(e)}))}var n=e.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,on(this)&&!un(this,{type:An,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=ln(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:An,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(on(this)&&!un(this,{type:Cn,object:this,oldValue:e}))return!1;if(this.has(e)){var n=ln(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:Cn,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return lr({next:function(){var r=e;return e+=1,rGn){for(var t=Gn;t=0&&n++}e=ur(e),t=ur(t);var s="[object Array]"===o;if(!s){if("object"!=typeof e||"object"!=typeof t)return!1;var u=e.constructor,l=t.constructor;if(u!==l&&!(v(u)&&u instanceof u&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),s){if((c=e.length)!==t.length)return!1;for(;c--;)if(!sr(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!k(t,f=p[c])||!sr(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function ur(e){return Sn(e)?e.slice():P(e)||In(e)||S(e)||Rn(e)?Array.from(e.entries()):e}function lr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&t("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:F});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function dr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var hr=function(){return hr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,a=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)o.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(i)throw i.error}}return o}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==ti.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Ar);Cr.prototype.die=Ct(Cr.prototype.die);var kr,Tr,Er=1,Ir={onError:function(e){throw e}},Nr=function(e){function t(t,n,r,i,a){var o=e.call(this,t,n,r,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Er}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Te((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,n||(o.identifierCache=new ri),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var s=o._initialSnapshot[o.identifierAttribute];if(void 0===s){var u=o._childNodes[o.identifierAttribute];u&&(s=u.value)}if("string"!=typeof s&&"number"!=typeof s)throw yi("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=za(s),o.unnormalizedIdentifier=s}return n?n.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return dr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var s=br(a),u=s.next();!u.done;u=s.next())(p=u.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=ti.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=bi,this.state=ti.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=br(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=ti.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Tt?Tt((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw yi(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&Vi(e.subpath)||"",r=e.actionContext||Fr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,a="";return r&&null!=r.name&&(a=(r&&r.context&&(si(i=r.context,1),ui(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(bi),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):pi(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw yi("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=br(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw yi("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=$r(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=zi(t.path);fi(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=$r(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),xi(this.storedValue,"$treenode",this),xi(this.storedValue,"toJSON",ci)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==ti.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,a,o,s;void 0===r&&(r=c);var u,l,f,p,d=null!=(i=r.name)?i:"Reaction",h=Ct(d,r.onError?(u=r.onError,l=n,function(){try{return l.apply(this,arguments)}catch(e){u.call(this,e)}}):n),b=!r.scheduler&&!r.delay,v=Dt(r),y=!0,g=!1,m=r.compareStructural?H.structural:r.equals||H.default,_=new bt(d,(function(){y||b?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!m(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=r)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(s=r)?void 0:s.signal)}(0,(function(t){return e.emitSnapshot(t)}),Ir);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new Ci),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Fr,Ur=1;function $r(e,t,n){var r=function(){var r=Ur++,i=Fr,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ui(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Fr;Fr=e;try{return function(e,t,n){var r=new Hr(e,n);if(r.isEmpty)return Ct(n).apply(null,t.args);var i=null;return function e(t){var a=r.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fr[t.name]?e(t):(o(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Ct(n).apply(null,t.args)}(t)}(n,e,t)}finally{Fr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:ki(arguments),context:e,tree:jr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}function Wr(e,t,n){return void 0===n&&(n=!0),ui(e).addMiddleWare(t,n)}var Hr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Kr(e){return"function"==typeof e?"":oi(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Gr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",a=oi(t)?"value of type "+ui(t).type.name+":":Pi(t)?"value":"snapshot",o=n&&oi(t)&&n.is(ui(t).snapshot);return""+i+a+" "+Kr(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return zr(e)&&(e.flags&(Tr.String|Tr.Number|Tr.Integer|Tr.Boolean|Tr.Date))>0}(n)||Pi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function qr(e,t,n){return e.concat([{path:t,type:n}])}function Xr(){return hi}function Jr(e,t,n){return[{context:e,value:t,message:n}]}function Yr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Qr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&ei(e,t)}function ei(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw yi(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Kr(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Gr).join("\n ")}(e,t,n))}var ti,ni=0,ri=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:ni++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:xe.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:xe.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,xe.array([],vi));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw yi("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Xt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,a=new e,o=n.path+"/";return(r=this.cache,Fn(r)?qt(r).map((function(e){return[e,r[e]]})):In(r)?qt(r).map((function(e){return[e,r.get(e)]})):Rn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void t(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],s=t[1],u=!1,l=s.length-1;l>=0;l--){var c=s[l];c!==n&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),s.splice(l,1),s.length||i.cache.delete(r),u=!0)}u&&i.updateLastCacheModificationPerId(r)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw yi("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),e}();function ii(e,t,n,r,i){var a=li(i);if(a){if(a.parent)throw yi("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,n),a}return new Nr(e,t,n,r,i)}function ai(e,t,n,r,i){return new Cr(e,t,n,r,i)}function oi(e){return!(!e||!e.$treenode)}function si(e,t){Ei()}function ui(e){if(!oi(e))throw yi("Value "+e+" is no MST Node");return e.$treenode}function li(e){return e&&e.$treenode||null}function ci(){return ui(this).snapshot}function fi(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=oi(r)?r:this.preProcessSnapshot(r),a=this._subtype.instantiate(e,t,n,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,oi(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Bi?Jr(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=zr(e)?this._subtype:oi(e)?Or(e,!1):this.preProcessSnapshotSafe(e);return t!==Bi&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Mr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Vr),Ui="Map.put can only be used to store complex values that have an identifier type attribute";function $i(e,t){var n,r,i=e.getSubTypes();if(i===Dr)return!1;if(i){var a=wi(i);try{for(var o=br(a),s=o.next();!s.done;s=o.next())if(!$i(s.value,t))return!1}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}return e instanceof ta&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Zi||(Zi={}));var Wi=function(e){function t(t,n){return e.call(this,t,xe.ref.enhancer,n)||this}return dr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw yi("Map.put cannot be used to set empty values");if(oi(e)){var t=ui(e);if(null===t.identifier)throw yi(Ui);return this.set(t.identifier,e),e}if(ji(e)){var n=ui(this),r=n.type;if(r.identifierMode!==Zi.YES)throw yi(Ui);var i=e[r.mapIdentifierAttribute];if(!Za(i)){var a=this.put(r.getChildType().create(e,n.environment));return this.put(Or(a))}var o=za(i);return this.set(o,e),this.get(o)}throw yi("Map.put can only be used to store complex values")}}),t}(En),Hi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Zi.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Tr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return dr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),ii(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Zi.UNKNOWN){var e=[];if($i(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw yi("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Zi.YES,this.mapIdentifierAttribute=t):this.identifierMode=Zi.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Wi(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Ht(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=$r(t,e,r);xi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Xt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw yi("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ui(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(n))return null;Qr(i,a),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Qr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Zi.YES&&t instanceof Nr){var n=t.identifier;if(n!==e)throw yi("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ui(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Vi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Vi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Vi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Qr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return Oi(e)?Yr(Object.keys(e).map((function(r){return n._subType.validate(e[r],qr(t,r,n._subType))}))):Jr(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return bi}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Mr);Hi.prototype.applySnapshot=Ct(Hi.prototype.applySnapshot);var Ki=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Tr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return dr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return ii(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var a=""+i;r[a]=n.instantiate(e,a,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hr(hr({},vi),{name:this.name});return xe.array(pi(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=$r(t,e,r);xi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=oi(e)?ui(e).snapshot:e;return this._predicate(r)?Xr():Jr(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vr),va=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=hr({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return dr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Tr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw yi("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw yi("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Qr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Xr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vr);function ma(e,t,n){return function(e,t){if("function"!=typeof t&&oi(t))throw yi("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Zr()}(0,t),new ga(e,t,n||_a)}var _a=[void 0],wa=ma(ca,void 0),Oa=ma(la,null);function ja(e){return Zr(),ya(e,wa)}var Pa=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return dr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Tr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw yi("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Xr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Dr}}),t}(Vr),Sa=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Tr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:xe.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Ct((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return dr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var a=ai(this,e,t,n,r);return this.pendingNodeList.push(a),tn((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):Si(e)?Xr():Jr(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Lr),xa=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Tr.Frozen}),n}return dr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return ai(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Si(e)?this.subType?this.subType.validate(e,t):Xr():Jr(t,e,"Value is not serializable and cannot be frozen")}}),t}(Lr),Aa=new xa,Ca=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Za(e))this.identifier=e;else{if(!oi(e))throw yi("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ui(e);if(!n.identifierAttribute)throw yi("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw yi("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=za(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,a=n.identifierCache.resolve(i,t);if(!a)throw new ka("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ka=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return dr(t,e),t}(Error),Ta=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Tr.Reference}),r}return dr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Za(e)?Xr():Jr(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;zr(e=i.type)&&(e.flags&Tr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ui(r),a=function(r,a){var o=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(a);o&&n.fireInvalidated(o,e,t,i)},o=i.registerHook(fr.beforeDetach,a),s=i.registerHook(fr.beforeDestroy,a);return function(){o(),s()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,s=o&&o.storedValue;o&&o.isAlive&&s&&((n?n.get(t,s):e.root.identifierCache.has(r.targetType,za(t)))?i=r.addTargetNodeWatcher(e,t):a||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===ti.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){a(!1)})))}}}),t}(Lr),Ea=function(e){function t(t,n){return e.call(this,t,n)||this}return dr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,a=oi(r)?(si(i=r),ui(i).identifier):r,o=new Ca(r,this.targetType),s=ai(this,e,t,n,o);return o.node=s,this.watchTargetNodeForInvalidations(s,a,void 0),s}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=oi(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(n,r),e}var o=this.instantiate(n,r,void 0,t);return e.die(),o}}),t}(Ta),Ia=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return dr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=oi(r)?this.options.set(r,e?e.storedValue:null):r,a=ai(this,e,t,n,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=oi(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var a=this.instantiate(n,r,void 0,i);return e.die(),a}}),t}(Ta);function Na(e,t){Zr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new Ia(e,{get:n.get,set:n.set},r):new Ea(e,r)}var Da=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Tr.Identifier}),r}return dr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof ta))throw yi("Identifier types can only be instantiated as direct child of a model type");return ai(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw yi("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Jr(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Xr()}}),t}(Lr),Ra=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Tr.Identifier}),t}return dr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(Da),Va=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return dr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(Da),Ma=new Ra,La=new Va;function za(e){return""+e}function Za(e){return"string"==typeof e||"number"==typeof e}var Ba=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Tr.Custom}),n}return dr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Xr();var n=this.options.getValidationMessage(e);return n?Jr(t,e,"Invalid value for type '"+this.name+"': "+n):Xr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return ai(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var a=i?this.options.fromSnapshot(t,n.root.environment):t,o=this.instantiate(n,r,void 0,a);return e.die(),o}}),t}(Lr),Fa={enumeration:function(e,t){var n="string"==typeof e?t:e,r=ya.apply(void 0,yr(n.map((function(e){return ha(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Zr(),new Ki(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?Aa:zr(e)?new xa(e):ma(Aa,e)},identifier:Ma,identifierNumber:La,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new Pa(n,"string"==typeof e?t:e)},lazy:function(e,t){return new Sa(e,t)},undefined:ca,null:la,snapshotProcessor:function(e,t,n){return Zr(),new Fi(e,t,n)}};const Ua=Fa.model({string:Fa.string,number:Fa.number,integer:Fa.integer,float:Fa.float,boolean:Fa.boolean,date:Fa.Date}).actions((e=>({setString(t){e.string=t},setNumber(t){e.number=t},setInteger(t){e.integer=t},setFloat(t){e.float=t},setBoolean(t){e.boolean=t},setDate(t){e.date=t}}))),$a=e=>{for(let t=0;te,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},e.getValidEnumValues=t=>{const n=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),r={};for(const e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(const n of e)if(t(n))return n},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(Wa||(Wa={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(Ha||(Ha={}));const Ka=Wa.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ga=e=>{switch(typeof e){case"undefined":return Ka.undefined;case"string":return Ka.string;case"number":return isNaN(e)?Ka.nan:Ka.number;case"boolean":return Ka.boolean;case"function":return Ka.function;case"bigint":return Ka.bigint;case"symbol":return Ka.symbol;case"object":return Array.isArray(e)?Ka.array:null===e?Ka.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?Ka.promise:"undefined"!=typeof Map&&e instanceof Map?Ka.map:"undefined"!=typeof Set&&e instanceof Set?Ka.set:"undefined"!=typeof Date&&e instanceof Date?Ka.date:Ka.object;default:return Ka.unknown}},qa=Wa.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Xa extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(r);else if("invalid_return_type"===i.code)r(i.returnTypeError);else if("invalid_arguments"===i.code)r(i.argumentsError);else if(0===i.path.length)n._errors.push(t(i));else{let e=n,r=0;for(;re.message)){const t={},n=[];for(const r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}Xa.create=e=>new Xa(e);const Ja=(e,t)=>{let n;switch(e.code){case qa.invalid_type:n=e.received===Ka.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case qa.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Wa.jsonStringifyReplacer)}`;break;case qa.unrecognized_keys:n=`Unrecognized key(s) in object: ${Wa.joinValues(e.keys,", ")}`;break;case qa.invalid_union:n="Invalid input";break;case qa.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Wa.joinValues(e.options)}`;break;case qa.invalid_enum_value:n=`Invalid enum value. Expected ${Wa.joinValues(e.options)}, received '${e.received}'`;break;case qa.invalid_arguments:n="Invalid function arguments";break;case qa.invalid_return_type:n="Invalid function return type";break;case qa.invalid_date:n="Invalid date";break;case qa.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Wa.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case qa.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case qa.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case qa.custom:n="Invalid input";break;case qa.invalid_intersection_types:n="Intersection results could not be merged";break;case qa.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case qa.not_finite:n="Number must be finite";break;default:n=t.defaultError,Wa.assertNever(e)}return{message:n}};let Ya=Ja;function Qa(){return Ya}const eo=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};let s="";const u=r.filter((e=>!!e)).slice().reverse();for(const e of u)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:i.message||s}};function to(e,t){const n=eo({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,Qa(),Ja].filter((e=>!!e))});e.common.issues.push(n)}class no{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const r of t){if("aborted"===r.status)return ro;"dirty"===r.status&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const e of t)n.push({key:await e.key,value:await e.value});return no.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const r of t){const{key:t,value:i}=r;if("aborted"===t.status)return ro;if("aborted"===i.status)return ro;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"===t.value||void 0===i.value&&!r.alwaysSet||(n[t.value]=i.value)}return{status:e.value,value:n}}}const ro=Object.freeze({status:"aborted"}),io=e=>({status:"dirty",value:e}),ao=e=>({status:"valid",value:e}),oo=e=>"aborted"===e.status,so=e=>"dirty"===e.status,uo=e=>"valid"===e.status,lo=e=>"undefined"!=typeof Promise&&e instanceof Promise;var co;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(co||(co={}));class fo{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const po=(e,t)=>{if(uo(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new Xa(e.common.issues);return this._error=t,this._error}}};function ho(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:i}:{errorMap:(e,t)=>"invalid_type"!==e.code?{message:t.defaultError}:void 0===t.data?{message:null!=r?r:t.defaultError}:{message:null!=n?n:t.defaultError},description:i}}class bo{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return Ga(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Ga(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new no,ctx:{common:e.parent.common,data:e.data,parsedType:Ga(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(lo(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const r={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ga(e)},i=this._parseSync({data:e,path:r.path,parent:r});return po(r,i)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ga(e)},r=this._parse({data:e,path:n.path,parent:n}),i=await(lo(r)?r:Promise.resolve(r));return po(n,i)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,r)=>{const i=e(t),a=()=>r.addIssue({code:qa.custom,...n(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then((e=>!!e||(a(),!1))):!!i||(a(),!1)}))}refinement(e,t){return this._refinement(((n,r)=>!!e(n)||(r.addIssue("function"==typeof t?t(n,r):t),!1)))}_refinement(e){return new ns({schema:this,typeName:hs.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return rs.create(this,this._def)}nullable(){return is.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Mo.create(this,this._def)}promise(){return ts.create(this,this._def)}or(e){return Zo.create([this,e],this._def)}and(e){return $o.create(this,e,this._def)}transform(e){return new ns({...ho(this._def),schema:this,typeName:hs.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new as({...ho(this._def),innerType:this,defaultValue:t,typeName:hs.ZodDefault})}brand(){return new ls({typeName:hs.ZodBranded,type:this,...ho(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new os({...ho(this._def),innerType:this,catchValue:t,typeName:hs.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return cs.create(this,e)}readonly(){return fs.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const vo=/^c[^\s-]{8,}$/i,yo=/^[a-z][a-z0-9]*$/,go=/^[0-9A-HJKMNP-TV-Z]{26}$/,mo=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,_o=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let wo;const Oo=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,jo=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;class Po extends bo{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Ka.string){const t=this._getOrReturnCtx(e);return to(t,{code:qa.invalid_type,expected:Ka.string,received:t.parsedType}),ro}const t=new no;let n;for(const o of this._def.checks)if("min"===o.kind)e.data.lengtho.value&&(n=this._getOrReturnCtx(e,n),to(n,{code:qa.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),t.dirty());else if("length"===o.kind){const r=e.data.length>o.value,i=e.data.lengthe.test(t)),{validation:t,code:qa.invalid_string,...co.errToObj(n)})}_addCheck(e){return new Po({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...co.errToObj(e)})}url(e){return this._addCheck({kind:"url",...co.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...co.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...co.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...co.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...co.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...co.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...co.errToObj(e)})}datetime(e){var t;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,...co.errToObj(null==e?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...co.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...co.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...co.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...co.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...co.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...co.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...co.errToObj(t)})}nonempty(e){return this.min(1,co.errToObj(e))}trim(){return new Po({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Po({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Po({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuer?n:r;return parseInt(e.toFixed(i).replace(".",""))%parseInt(t.toFixed(i).replace(".",""))/Math.pow(10,i)}Po.create=e=>{var t;return new Po({checks:[],typeName:hs.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...ho(e)})};class xo extends bo{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Ka.number){const t=this._getOrReturnCtx(e);return to(t,{code:qa.invalid_type,expected:Ka.number,received:t.parsedType}),ro}let t;const n=new no;for(const r of this._def.checks)"int"===r.kind?Wa.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),to(t,{code:qa.invalid_type,expected:"integer",received:"float",message:r.message}),n.dirty()):"min"===r.kind?(r.inclusive?e.datar.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),to(t,{code:qa.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):"multipleOf"===r.kind?0!==So(e.data,r.value)&&(t=this._getOrReturnCtx(e,t),to(t,{code:qa.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):"finite"===r.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),to(t,{code:qa.not_finite,message:r.message}),n.dirty()):Wa.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,co.toString(t))}gt(e,t){return this.setLimit("min",e,!1,co.toString(t))}lte(e,t){return this.setLimit("max",e,!0,co.toString(t))}lt(e,t){return this.setLimit("max",e,!1,co.toString(t))}setLimit(e,t,n,r){return new xo({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:co.toString(r)}]})}_addCheck(e){return new xo({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:co.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:co.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:co.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:co.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:co.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:co.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:co.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:co.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:co.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value"int"===e.kind||"multipleOf"===e.kind&&Wa.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.valuenew xo({checks:[],typeName:hs.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...ho(e)});class Ao extends bo{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==Ka.bigint){const t=this._getOrReturnCtx(e);return to(t,{code:qa.invalid_type,expected:Ka.bigint,received:t.parsedType}),ro}let t;const n=new no;for(const r of this._def.checks)"min"===r.kind?(r.inclusive?e.datar.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),to(t,{code:qa.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):"multipleOf"===r.kind?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),to(t,{code:qa.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):Wa.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,co.toString(t))}gt(e,t){return this.setLimit("min",e,!1,co.toString(t))}lte(e,t){return this.setLimit("max",e,!0,co.toString(t))}lt(e,t){return this.setLimit("max",e,!1,co.toString(t))}setLimit(e,t,n,r){return new Ao({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:co.toString(r)}]})}_addCheck(e){return new Ao({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:co.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:co.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:co.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:co.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:co.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value{var t;return new Ao({checks:[],typeName:hs.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...ho(e)})};class Co extends bo{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==Ka.boolean){const t=this._getOrReturnCtx(e);return to(t,{code:qa.invalid_type,expected:Ka.boolean,received:t.parsedType}),ro}return ao(e.data)}}Co.create=e=>new Co({typeName:hs.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...ho(e)});class ko extends bo{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Ka.date){const t=this._getOrReturnCtx(e);return to(t,{code:qa.invalid_type,expected:Ka.date,received:t.parsedType}),ro}if(isNaN(e.data.getTime()))return to(this._getOrReturnCtx(e),{code:qa.invalid_date}),ro;const t=new no;let n;for(const r of this._def.checks)"min"===r.kind?e.data.getTime()r.value&&(n=this._getOrReturnCtx(e,n),to(n,{code:qa.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),t.dirty()):Wa.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ko({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:co.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:co.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuenew ko({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:hs.ZodDate,...ho(e)});class To extends bo{_parse(e){if(this._getType(e)!==Ka.symbol){const t=this._getOrReturnCtx(e);return to(t,{code:qa.invalid_type,expected:Ka.symbol,received:t.parsedType}),ro}return ao(e.data)}}To.create=e=>new To({typeName:hs.ZodSymbol,...ho(e)});class Eo extends bo{_parse(e){if(this._getType(e)!==Ka.undefined){const t=this._getOrReturnCtx(e);return to(t,{code:qa.invalid_type,expected:Ka.undefined,received:t.parsedType}),ro}return ao(e.data)}}Eo.create=e=>new Eo({typeName:hs.ZodUndefined,...ho(e)});class Io extends bo{_parse(e){if(this._getType(e)!==Ka.null){const t=this._getOrReturnCtx(e);return to(t,{code:qa.invalid_type,expected:Ka.null,received:t.parsedType}),ro}return ao(e.data)}}Io.create=e=>new Io({typeName:hs.ZodNull,...ho(e)});class No extends bo{constructor(){super(...arguments),this._any=!0}_parse(e){return ao(e.data)}}No.create=e=>new No({typeName:hs.ZodAny,...ho(e)});class Do extends bo{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ao(e.data)}}Do.create=e=>new Do({typeName:hs.ZodUnknown,...ho(e)});class Ro extends bo{_parse(e){const t=this._getOrReturnCtx(e);return to(t,{code:qa.invalid_type,expected:Ka.never,received:t.parsedType}),ro}}Ro.create=e=>new Ro({typeName:hs.ZodNever,...ho(e)});class Vo extends bo{_parse(e){if(this._getType(e)!==Ka.undefined){const t=this._getOrReturnCtx(e);return to(t,{code:qa.invalid_type,expected:Ka.void,received:t.parsedType}),ro}return ao(e.data)}}Vo.create=e=>new Vo({typeName:hs.ZodVoid,...ho(e)});class Mo extends bo{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==Ka.array)return to(t,{code:qa.invalid_type,expected:Ka.array,received:t.parsedType}),ro;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,i=t.data.lengthr.maxLength.value&&(to(t,{code:qa.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>r.type._parseAsync(new fo(t,e,t.path,n))))).then((e=>no.mergeArray(n,e)));const i=[...t.data].map(((e,n)=>r.type._parseSync(new fo(t,e,t.path,n))));return no.mergeArray(n,i)}get element(){return this._def.type}min(e,t){return new Mo({...this._def,minLength:{value:e,message:co.toString(t)}})}max(e,t){return new Mo({...this._def,maxLength:{value:e,message:co.toString(t)}})}length(e,t){return new Mo({...this._def,exactLength:{value:e,message:co.toString(t)}})}nonempty(e){return this.min(1,e)}}function Lo(e){if(e instanceof zo){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=rs.create(Lo(r))}return new zo({...e._def,shape:()=>t})}return e instanceof Mo?new Mo({...e._def,type:Lo(e.element)}):e instanceof rs?rs.create(Lo(e.unwrap())):e instanceof is?is.create(Lo(e.unwrap())):e instanceof Wo?Wo.create(e.items.map((e=>Lo(e)))):e}Mo.create=(e,t)=>new Mo({type:e,minLength:null,maxLength:null,exactLength:null,typeName:hs.ZodArray,...ho(t)});class zo extends bo{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=Wa.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==Ka.object){const t=this._getOrReturnCtx(e);return to(t,{code:qa.invalid_type,expected:Ka.object,received:t.parsedType}),ro}const{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ro&&"strip"===this._def.unknownKeys))for(const e in n.data)i.includes(e)||a.push(e);const o=[];for(const e of i){const t=r[e],i=n.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new fo(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof Ro){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of a)o.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)a.length>0&&(to(n,{code:qa.unrecognized_keys,keys:a}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of a){const r=n.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new fo(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of o){const n=await t.key;e.push({key:n,value:await t.value,alwaysSet:t.alwaysSet})}return e})).then((e=>no.mergeObjectSync(t,e))):no.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return co.errToObj,new zo({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var r,i,a,o;const s=null!==(a=null===(i=(r=this._def).errorMap)||void 0===i?void 0:i.call(r,t,n).message)&&void 0!==a?a:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(o=co.errToObj(e).message)&&void 0!==o?o:s}:{message:s}}}:{}})}strip(){return new zo({...this._def,unknownKeys:"strip"})}passthrough(){return new zo({...this._def,unknownKeys:"passthrough"})}extend(e){return new zo({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new zo({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:hs.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new zo({...this._def,catchall:e})}pick(e){const t={};return Wa.objectKeys(e).forEach((n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])})),new zo({...this._def,shape:()=>t})}omit(e){const t={};return Wa.objectKeys(this.shape).forEach((n=>{e[n]||(t[n]=this.shape[n])})),new zo({...this._def,shape:()=>t})}deepPartial(){return Lo(this)}partial(e){const t={};return Wa.objectKeys(this.shape).forEach((n=>{const r=this.shape[n];e&&!e[n]?t[n]=r:t[n]=r.optional()})),new zo({...this._def,shape:()=>t})}required(e){const t={};return Wa.objectKeys(this.shape).forEach((n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof rs;)e=e._def.innerType;t[n]=e}})),new zo({...this._def,shape:()=>t})}keyof(){return Yo(Wa.objectKeys(this.shape))}}zo.create=(e,t)=>new zo({shape:()=>e,unknownKeys:"strip",catchall:Ro.create(),typeName:hs.ZodObject,...ho(t)}),zo.strictCreate=(e,t)=>new zo({shape:()=>e,unknownKeys:"strict",catchall:Ro.create(),typeName:hs.ZodObject,...ho(t)}),zo.lazycreate=(e,t)=>new zo({shape:e,unknownKeys:"strip",catchall:Ro.create(),typeName:hs.ZodObject,...ho(t)});class Zo extends bo{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const n=e.map((e=>new Xa(e.ctx.common.issues)));return to(t,{code:qa.invalid_union,unionErrors:n}),ro}));{let e;const r=[];for(const i of n){const n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if("valid"===a.status)return a;"dirty"!==a.status||e||(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const i=r.map((e=>new Xa(e)));return to(t,{code:qa.invalid_union,unionErrors:i}),ro}}get options(){return this._def.options}}Zo.create=(e,t)=>new Zo({options:e,typeName:hs.ZodUnion,...ho(t)});const Bo=e=>e instanceof Xo?Bo(e.schema):e instanceof ns?Bo(e.innerType()):e instanceof Jo?[e.value]:e instanceof Qo?e.options:e instanceof es?Object.keys(e.enum):e instanceof as?Bo(e._def.innerType):e instanceof Eo?[void 0]:e instanceof Io?[null]:null;class Fo extends bo{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ka.object)return to(t,{code:qa.invalid_type,expected:Ka.object,received:t.parsedType}),ro;const n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(to(t,{code:qa.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ro)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const r=new Map;for(const n of t){const t=Bo(n.shape[e]);if(!t)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const i of t){if(r.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);r.set(i,n)}}return new Fo({typeName:hs.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...ho(n)})}}function Uo(e,t){const n=Ga(e),r=Ga(t);if(e===t)return{valid:!0,data:e};if(n===Ka.object&&r===Ka.object){const n=Wa.objectKeys(t),r=Wa.objectKeys(e).filter((e=>-1!==n.indexOf(e))),i={...e,...t};for(const n of r){const r=Uo(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}if(n===Ka.array&&r===Ka.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let r=0;r{if(oo(e)||oo(r))return ro;const i=Uo(e.value,r.value);return i.valid?((so(e)||so(r))&&t.dirty(),{status:t.value,value:i.data}):(to(n,{code:qa.invalid_intersection_types}),ro)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then((([e,t])=>r(e,t))):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}$o.create=(e,t,n)=>new $o({left:e,right:t,typeName:hs.ZodIntersection,...ho(n)});class Wo extends bo{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Ka.array)return to(n,{code:qa.invalid_type,expected:Ka.array,received:n.parsedType}),ro;if(n.data.lengththis._def.items.length&&(to(n,{code:qa.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...n.data].map(((e,t)=>{const r=this._def.items[t]||this._def.rest;return r?r._parse(new fo(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(r).then((e=>no.mergeArray(t,e))):no.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new Wo({...this._def,rest:e})}}Wo.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Wo({items:e,typeName:hs.ZodTuple,rest:null,...ho(t)})};class Ho extends bo{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Ka.object)return to(n,{code:qa.invalid_type,expected:Ka.object,received:n.parsedType}),ro;const r=[],i=this._def.keyType,a=this._def.valueType;for(const e in n.data)r.push({key:i._parse(new fo(n,e,n.path,e)),value:a._parse(new fo(n,n.data[e],n.path,e))});return n.common.async?no.mergeObjectAsync(t,r):no.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,n){return new Ho(t instanceof bo?{keyType:e,valueType:t,typeName:hs.ZodRecord,...ho(n)}:{keyType:Po.create(),valueType:e,typeName:hs.ZodRecord,...ho(t)})}}class Ko extends bo{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Ka.map)return to(n,{code:qa.invalid_type,expected:Ka.map,received:n.parsedType}),ro;const r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map((([e,t],a)=>({key:r._parse(new fo(n,e,n.path,[a,"key"])),value:i._parse(new fo(n,t,n.path,[a,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of a){const r=await n.key,i=await n.value;if("aborted"===r.status||"aborted"===i.status)return ro;"dirty"!==r.status&&"dirty"!==i.status||t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of a){const r=n.key,i=n.value;if("aborted"===r.status||"aborted"===i.status)return ro;"dirty"!==r.status&&"dirty"!==i.status||t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}}Ko.create=(e,t,n)=>new Ko({valueType:t,keyType:e,typeName:hs.ZodMap,...ho(n)});class Go extends bo{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Ka.set)return to(n,{code:qa.invalid_type,expected:Ka.set,received:n.parsedType}),ro;const r=this._def;null!==r.minSize&&n.data.sizer.maxSize.value&&(to(n,{code:qa.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const i=this._def.valueType;function a(e){const n=new Set;for(const r of e){if("aborted"===r.status)return ro;"dirty"===r.status&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}const o=[...n.data.values()].map(((e,t)=>i._parse(new fo(n,e,n.path,t))));return n.common.async?Promise.all(o).then((e=>a(e))):a(o)}min(e,t){return new Go({...this._def,minSize:{value:e,message:co.toString(t)}})}max(e,t){return new Go({...this._def,maxSize:{value:e,message:co.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Go.create=(e,t)=>new Go({valueType:e,minSize:null,maxSize:null,typeName:hs.ZodSet,...ho(t)});class qo extends bo{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ka.function)return to(t,{code:qa.invalid_type,expected:Ka.function,received:t.parsedType}),ro;function n(e,n){return eo({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Qa(),Ja].filter((e=>!!e)),issueData:{code:qa.invalid_arguments,argumentsError:n}})}function r(e,n){return eo({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Qa(),Ja].filter((e=>!!e)),issueData:{code:qa.invalid_return_type,returnTypeError:n}})}const i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof ts){const e=this;return ao((async function(...t){const o=new Xa([]),s=await e._def.args.parseAsync(t,i).catch((e=>{throw o.addIssue(n(t,e)),o})),u=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(u,i).catch((e=>{throw o.addIssue(r(u,e)),o}))}))}{const e=this;return ao((function(...t){const o=e._def.args.safeParse(t,i);if(!o.success)throw new Xa([n(t,o.error)]);const s=Reflect.apply(a,this,o.data),u=e._def.returns.safeParse(s,i);if(!u.success)throw new Xa([r(s,u.error)]);return u.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new qo({...this._def,args:Wo.create(e).rest(Do.create())})}returns(e){return new qo({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new qo({args:e||Wo.create([]).rest(Do.create()),returns:t||Do.create(),typeName:hs.ZodFunction,...ho(n)})}}class Xo extends bo{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Xo.create=(e,t)=>new Xo({getter:e,typeName:hs.ZodLazy,...ho(t)});class Jo extends bo{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return to(t,{received:t.data,code:qa.invalid_literal,expected:this._def.value}),ro}return{status:"valid",value:e.data}}get value(){return this._def.value}}function Yo(e,t){return new Qo({values:e,typeName:hs.ZodEnum,...ho(t)})}Jo.create=(e,t)=>new Jo({value:e,typeName:hs.ZodLiteral,...ho(t)});class Qo extends bo{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return to(t,{expected:Wa.joinValues(n),received:t.parsedType,code:qa.invalid_type}),ro}if(-1===this._def.values.indexOf(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return to(t,{received:t.data,code:qa.invalid_enum_value,options:n}),ro}return ao(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e){return Qo.create(e)}exclude(e){return Qo.create(this.options.filter((t=>!e.includes(t))))}}Qo.create=Yo;class es extends bo{_parse(e){const t=Wa.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Ka.string&&n.parsedType!==Ka.number){const e=Wa.objectValues(t);return to(n,{expected:Wa.joinValues(e),received:n.parsedType,code:qa.invalid_type}),ro}if(-1===t.indexOf(e.data)){const e=Wa.objectValues(t);return to(n,{received:n.data,code:qa.invalid_enum_value,options:e}),ro}return ao(e.data)}get enum(){return this._def.values}}es.create=(e,t)=>new es({values:e,typeName:hs.ZodNativeEnum,...ho(t)});class ts extends bo{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ka.promise&&!1===t.common.async)return to(t,{code:qa.invalid_type,expected:Ka.promise,received:t.parsedType}),ro;const n=t.parsedType===Ka.promise?t.data:Promise.resolve(t.data);return ao(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}ts.create=(e,t)=>new ts({type:e,typeName:hs.ZodPromise,...ho(t)});class ns extends bo{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===hs.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{to(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===r.type){const e=r.transform(n.data,i);return n.common.issues.length?{status:"dirty",value:n.data}:n.common.async?Promise.resolve(e).then((e=>this._def.schema._parseAsync({data:e,path:n.path,parent:n}))):this._def.schema._parseSync({data:e,path:n.path,parent:n})}if("refinement"===r.type){const e=e=>{const t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===r.status?ro:("dirty"===r.status&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((n=>"aborted"===n.status?ro:("dirty"===n.status&&t.dirty(),e(n.value).then((()=>({status:t.value,value:n.value}))))))}if("transform"===r.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!uo(e))return e;const a=r.transform(e.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((e=>uo(e)?Promise.resolve(r.transform(e.value,i)).then((e=>({status:t.value,value:e}))):e))}Wa.assertNever(r)}}ns.create=(e,t,n)=>new ns({schema:e,typeName:hs.ZodEffects,effect:t,...ho(n)}),ns.createWithPreprocess=(e,t,n)=>new ns({schema:t,effect:{type:"preprocess",transform:e},typeName:hs.ZodEffects,...ho(n)});class rs extends bo{_parse(e){return this._getType(e)===Ka.undefined?ao(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}rs.create=(e,t)=>new rs({innerType:e,typeName:hs.ZodOptional,...ho(t)});class is extends bo{_parse(e){return this._getType(e)===Ka.null?ao(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}is.create=(e,t)=>new is({innerType:e,typeName:hs.ZodNullable,...ho(t)});class as extends bo{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===Ka.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}as.create=(e,t)=>new as({innerType:e,typeName:hs.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...ho(t)});class os extends bo{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return lo(r)?r.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new Xa(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new Xa(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}os.create=(e,t)=>new os({innerType:e,typeName:hs.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...ho(t)});class ss extends bo{_parse(e){if(this._getType(e)!==Ka.nan){const t=this._getOrReturnCtx(e);return to(t,{code:qa.invalid_type,expected:Ka.nan,received:t.parsedType}),ro}return{status:"valid",value:e.data}}}ss.create=e=>new ss({typeName:hs.ZodNaN,...ho(e)});const us=Symbol("zod_brand");class ls extends bo{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class cs extends bo{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?ro:"dirty"===e.status?(t.dirty(),io(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?ro:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new cs({in:e,out:t,typeName:hs.ZodPipeline})}}class fs extends bo{_parse(e){const t=this._def.innerType._parse(e);return uo(t)&&(t.value=Object.freeze(t.value)),t}}fs.create=(e,t)=>new fs({innerType:e,typeName:hs.ZodReadonly,...ho(t)});const ps=(e,t={},n)=>e?No.create().superRefine(((r,i)=>{var a,o;if(!e(r)){const e="function"==typeof t?t(r):"string"==typeof t?{message:t}:t,s=null===(o=null!==(a=e.fatal)&&void 0!==a?a:n)||void 0===o||o,u="string"==typeof e?{message:e}:e;i.addIssue({code:"custom",...u,fatal:s})}})):No.create(),ds={object:zo.lazycreate};var hs;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(hs||(hs={}));const bs=Po.create,vs=xo.create,ys=ss.create,gs=Ao.create,ms=Co.create,_s=ko.create,ws=To.create,Os=Eo.create,js=Io.create,Ps=No.create,Ss=Do.create,xs=Ro.create,As=Vo.create,Cs=Mo.create,ks=zo.create,Ts=zo.strictCreate,Es=Zo.create,Is=Fo.create,Ns=$o.create,Ds=Wo.create,Rs=Ho.create,Vs=Ko.create,Ms=Go.create,Ls=qo.create,zs=Xo.create,Zs=Jo.create,Bs=Qo.create,Fs=es.create,Us=ts.create,$s=ns.create,Ws=rs.create,Hs=is.create,Ks=ns.createWithPreprocess,Gs=cs.create,qs={string:e=>Po.create({...e,coerce:!0}),number:e=>xo.create({...e,coerce:!0}),boolean:e=>Co.create({...e,coerce:!0}),bigint:e=>Ao.create({...e,coerce:!0}),date:e=>ko.create({...e,coerce:!0})},Xs=ro;var Js=Object.freeze({__proto__:null,defaultErrorMap:Ja,setErrorMap:function(e){Ya=e},getErrorMap:Qa,makeIssue:eo,EMPTY_PATH:[],addIssueToContext:to,ParseStatus:no,INVALID:ro,DIRTY:io,OK:ao,isAborted:oo,isDirty:so,isValid:uo,isAsync:lo,get util(){return Wa},get objectUtil(){return Ha},ZodParsedType:Ka,getParsedType:Ga,ZodType:bo,ZodString:Po,ZodNumber:xo,ZodBigInt:Ao,ZodBoolean:Co,ZodDate:ko,ZodSymbol:To,ZodUndefined:Eo,ZodNull:Io,ZodAny:No,ZodUnknown:Do,ZodNever:Ro,ZodVoid:Vo,ZodArray:Mo,ZodObject:zo,ZodUnion:Zo,ZodDiscriminatedUnion:Fo,ZodIntersection:$o,ZodTuple:Wo,ZodRecord:Ho,ZodMap:Ko,ZodSet:Go,ZodFunction:qo,ZodLazy:Xo,ZodLiteral:Jo,ZodEnum:Qo,ZodNativeEnum:es,ZodPromise:ts,ZodEffects:ns,ZodTransformer:ns,ZodOptional:rs,ZodNullable:is,ZodDefault:as,ZodCatch:os,ZodNaN:ss,BRAND:us,ZodBranded:ls,ZodPipeline:cs,ZodReadonly:fs,custom:ps,Schema:bo,ZodSchema:bo,late:ds,get ZodFirstPartyTypeKind(){return hs},coerce:qs,any:Ps,array:Cs,bigint:gs,boolean:ms,date:_s,discriminatedUnion:Is,effect:$s,enum:Bs,function:Ls,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>ps((t=>t instanceof e),t),intersection:Ns,lazy:zs,literal:Zs,map:Vs,nan:ys,nativeEnum:Fs,never:xs,null:js,nullable:Hs,number:vs,object:ks,oboolean:()=>ms().optional(),onumber:()=>vs().optional(),optional:Ws,ostring:()=>bs().optional(),pipeline:Gs,preprocess:Ks,promise:Us,record:Rs,set:Ms,strictObject:Ts,string:bs,symbol:ws,transformer:$s,tuple:Ds,undefined:Os,union:Es,unknown:Ss,void:As,NEVER:Xs,ZodIssueCode:qa,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:Xa});const Ys=Fa.model({id:Fa.identifier,name:Fa.string,age:Fa.number,isHappy:Fa.boolean,createdAt:Fa.Date,updatedAt:Fa.maybeNull(Fa.Date),favoriteColors:Fa.array(Fa.string),favoriteNumbers:Fa.array(Fa.number),favoriteFoods:Fa.array(Fa.model({name:Fa.string,calories:Fa.number}))}),Qs=Fa.model({id:Fa.identifier,shouldMatch:!1}),eu=Js.object({id:Js.number(),name:Js.string(),age:Js.number(),isHappy:Js.boolean(),createdAt:Js.date(),updatedAt:Js.date().nullable(),favoriteColors:Js.array(Js.string()),favoriteNumbers:Js.array(Js.number()),favoriteFoods:Js.array(Js.object({name:Js.string(),calories:Js.number()}))}),tu=Fa.model({id:Fa.identifier,name:Fa.string,age:Fa.number}),nu=Fa.model({users:Fa.array(tu)}).views((e=>({get numberOfChildren(){return e.users.filter((e=>e.age<18)).length},numberOfPeopleOlderThan:t=>e.users.filter((e=>e.age>t)).length}))).create({users:[{id:"1",name:"John",age:42},{id:"2",name:"Jane",age:47}]}),ru=Fa.model({name:Fa.string,id:Fa.string}),iu=Fa.model({items:Fa.array(ru)}).actions((e=>({add(t,n){e.items.push({name:t,id:n})}}))),au=e=>{const t=iu.create({items:[]});for(let n=0;n{$a(1)}},uu={title:"Create 10 models",longDescription:"Create 10 models with all primitive types, along with a setter action for each.",run:()=>{$a(10)}},lu={title:"Create 100 models",longDescription:"Create 100 models with all primitive types, along with a setter action for each.",run:()=>{$a(100)}},cu={title:"Create 1,000 models",longDescription:"Create 1,000 models with all primitive types, along with a setter action for each.",run:()=>{$a(1e3)}},fu={title:"Create 10,000 models",longDescription:"Create 10,000 models with all primitive types, along with a setter action for each.",run:()=>{$a(1e4)}},pu={title:"Create 100,000 models",longDescription:"Create 100,000 models with all primitive types, along with a setter action for each.",run:()=>{$a(1e5)}},du={title:"Create 1 model and set a string value",longDescription:"Create 1 model with all primitive types, along with a setter action for each. Then, set a string value.",run:()=>{Ua.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}).setString("new string")}},hu={title:"Create 1 model and set a number value",longDescription:"Create 1 model with all primitive types, along with a setter action for each. Then, set a number value.",run:()=>{Ua.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}).setNumber(2)}},bu={title:"Create 1 model and set an integer value",longDescription:"Create 1 model with all primitive types, along with a setter action for each. Then, set an integer value.",run:()=>{Ua.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}).setInteger(2)}},vu={title:"Create 1 model and set a float value",longDescription:"Create 1 model with all primitive types, along with a setter action for each. Then, set a float value.",run:()=>{Ua.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}).setFloat(2.2)}},yu={title:"Create 1 model and set a boolean value",longDescription:"Create 1 model with all primitive types, along with a setter action for each. Then, set a boolean value.",run:()=>{Ua.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}).setBoolean(!1)}},gu={title:"Create 1 model and set a date value",longDescription:"Create 1 model with all primitive types, along with a setter action for each. Then, set a date value.",run:()=>{Ua.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}).setDate(new Date)}},mu={title:"Create a types.string",longDescription:"Create a types.string.",run:()=>{Fa.string.create("string")}},_u={title:"Create a types.number",longDescription:"Create a types.number.",run:()=>{Fa.number.create(1)}},wu={title:"Create a types.integer",longDescription:"Create a types.integer.",run:()=>{Fa.integer.create(1)}},Ou={title:"Create a types.float",longDescription:"Create a types.float.",run:()=>{Fa.float.create(1.1)}},ju={title:"Create a types.boolean",longDescription:"Create a types.boolean.",run:()=>{Fa.boolean.create(!0)}},Pu={title:"Create a types.Date",longDescription:"Create a types.Date.",run:()=>{Fa.Date.create(new Date)}},Su={title:"Create a types.array(types.string)",longDescription:"Create a types.array(types.string).",run:()=>{Fa.array(Fa.string).create(["string"])}},xu={title:"Create a types.array(types.number)",longDescription:"Create a types.array(types.number).",run:()=>{Fa.array(Fa.number).create([1])}},Au={title:"Create a types.array(types.integer)",longDescription:"Create a types.array(types.integer).",run:()=>{Fa.array(Fa.integer).create([1])}},Cu={title:"Create a types.array(types.float)",longDescription:"Create a types.array(types.float).",run:()=>{Fa.array(Fa.float).create([1.1])}},ku={title:"Create a types.array(types.boolean)",longDescription:"Create a types.array(types.boolean).",run:()=>{Fa.array(Fa.boolean).create([!0])}},Tu={title:"Create a types.array(types.Date)",longDescription:"Create a types.array(types.Date).",run:()=>{Fa.array(Fa.Date).create([new Date])}},Eu={title:"Create a types.map(types.string)",longDescription:"Create a types.map(types.string).",run:()=>{Fa.map(Fa.string).create({string:"string"})}},Iu={title:"Create a types.map(types.number)",longDescription:"Create a types.map(types.number).",run:()=>{Fa.map(Fa.number).create({number:1})}},Nu={title:"Create a types.map(types.integer)",longDescription:"Create a types.map(types.integer).",run:()=>{Fa.map(Fa.integer).create({integer:1})}},Du={title:"Create a types.map(types.float)",longDescription:"Create a types.map(types.float).",run:()=>{Fa.map(Fa.float).create({float:1.1})}},Ru={title:"Create a types.map(types.boolean)",longDescription:"Create a types.map(types.boolean).",run:()=>{Fa.map(Fa.boolean).create({boolean:!0})}},Vu={title:"Create a types.map(types.Date)",longDescription:"Create a types.map(types.Date).",run:()=>{Fa.map(Fa.Date).create({date:new Date})}},Mu={title:"Check a valid model with MST typecheck",run:()=>{(()=>{const e=Ys.create({id:"1",name:"John",age:42,isHappy:!0,createdAt:new Date,updatedAt:null,favoriteColors:["blue","green"],favoriteNumbers:[1,2,3],favoriteFoods:[{name:"Pizza",calories:1e3}]});ei(Ys,e)})()}},Lu={title:"Check an invalid model with MST typecheck",run:()=>{(()=>{const e=Ys.create({id:"1",name:"John",age:42,isHappy:!0,createdAt:new Date,updatedAt:null,favoriteColors:["blue","green"],favoriteNumbers:[1,2,3],favoriteFoods:[{name:"Pizza",calories:1e3}]});try{ei(Qs,e)}catch(e){return}})()}},zu={title:"Check a valid snapshot with MST typecheck",run:()=>{ei(Ys,{id:"1",name:"John",age:42,isHappy:!0,createdAt:new Date,updatedAt:null,favoriteColors:["blue","green"],favoriteNumbers:[1,2,3],favoriteFoods:[{name:"Pizza",calories:1e3}]})}},Zu={title:"Check an invalid snapshot with MST typecheck",run:()=>{(()=>{try{ei(Qs,{id:"1",name:"John",age:42,isHappy:!0,createdAt:new Date,updatedAt:null,favoriteColors:["blue","green"],favoriteNumbers:[1,2,3],favoriteFoods:[{name:"Pizza",calories:1e3}]})}catch(e){return}})()}},Bu={title:"Check a valid model with Zod typecheck",run:()=>{(()=>{const e={id:1,name:"John",age:42,isHappy:!0,createdAt:new Date,updatedAt:null,favoriteColors:["blue","green"],favoriteNumbers:[1,2,3],favoriteFoods:[{name:"Pizza",calories:1e3}]};eu.parse(e)})()}},Fu={title:"Check an invalid model with Zod typecheck",run:()=>{(()=>{const e={id:1,name:"John"};try{eu.parse(e)}catch(e){return}})()}},Uu={title:"Create a model and add actions to it",run:()=>{const e=Fa.model({string:Fa.string,number:Fa.number,integer:Fa.integer,float:Fa.float,boolean:Fa.boolean,date:Fa.Date}).actions((e=>({setString:t=>{e.string=t},setNumber:t=>{e.number=t},setInteger:t=>{e.integer=t},setFloat:t=>{e.float=t},setBoolean:t=>{e.boolean=t},setDate:t=>{e.date=t}})));e.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}).setString("new string")}},$u={title:"Create a model and add views to it",run:()=>{Fa.model({string:Fa.string,number:Fa.number,integer:Fa.integer,float:Fa.float,boolean:Fa.boolean,date:Fa.Date}).views((e=>({getString:()=>e.string,getNumber:()=>e.number,getInteger:()=>e.integer,getFloat:()=>e.float,getBoolean:()=>e.boolean,getDate:()=>e.date}))).create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}).getString()}},Wu={title:"Create a model and add both actions and views to it",run:()=>{const e=Fa.model({string:Fa.string,number:Fa.number,integer:Fa.integer,float:Fa.float,boolean:Fa.boolean,date:Fa.Date}).actions((e=>({setString:t=>{e.string=t},setNumber:t=>{e.number=t},setInteger:t=>{e.integer=t},setFloat:t=>{e.float=t},setBoolean:t=>{e.boolean=t},setDate:t=>{e.date=t}}))).views((e=>({getString:()=>e.string,getNumber:()=>e.number,getInteger:()=>e.integer,getFloat:()=>e.float,getBoolean:()=>e.boolean,getDate:()=>e.date})));e.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}).getString()}},Hu={title:"Declare a model with a reference and retrieve a value from it",run:()=>{(()=>{const e=Fa.model({id:Fa.identifier,title:Fa.string});Fa.model({todos:Fa.array(e),selectedTodo:Fa.reference(e)}).create({todos:[{id:"47",title:"Get coffee"}],selectedTodo:"47"}).selectedTodo.title})()}},Ku={title:"Add onAction to a model",run:()=>{const e=Fa.model({task:Fa.string}),t=Fa.model({todos:Fa.array(e)}).actions((e=>({add(t){e.todos.push(t)}}))).create({todos:[]});return onAction(t,(e=>{console.log(e)}))}},Gu={title:"Add middleware to an action and include hooks (default)",run:()=>{const e=Fa.model({task:Fa.string});Wr(Fa.model({todos:Fa.array(e)}).actions((e=>({add(t){e.todos.push(t)}}))).create({todos:[]}),(()=>{}))}},qu={title:"Add middleware to an action and do not include hooks",run:()=>{const e=Fa.model({task:Fa.string});Wr(Fa.model({todos:Fa.array(e)}).actions((e=>({add(t){e.todos.push(t)}}))).create({todos:[]}),(()=>{}),!1)}},Xu={title:"Create 1 model and set a string value using applyAction",run:()=>{Ua.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}),Br(Ua,{name:"setString",path:"",args:["new string"]})}},Ju={title:"Create 1 model and set a number value using applyAction",run:()=>{Ua.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}),Br(Ua,{name:"setNumber",path:"",args:[2]})}},Yu={title:"Create 1 model and set an integer value using applyAction",run:()=>{Ua.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}),Br(Ua,{name:"setInteger",path:"",args:[2]})}},Qu={title:"Create 1 model and set a float value using applyAction",run:()=>{Ua.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}),Br(Ua,{name:"setFloat",path:"",args:[2.2]})}},el={title:"Create 1 model and set a boolean value using applyAction",run:()=>{Ua.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}),Br(Ua,{name:"setBoolean",path:"",args:[!1]})}},tl={title:"Create 1 model and set a date value using applyAction",run:()=>{Ua.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}),Br(Ua,{name:"setDate",path:"",args:[new Date]})}},nl={title:"Get a computed value once",run:()=>{nu.numberOfChildren}},rl={title:"Get a computed value twice (should be cached)",run:()=>{nu.numberOfChildren,nu.numberOfChildren}},il={title:"Get a view with a parameter once",run:()=>{nu.numberOfPeopleOlderThan(50)}},al={title:"Get a view with a parameter twice (not cached)",run:()=>{nu.numberOfPeopleOlderThan(50),nu.numberOfPeopleOlderThan(50)}},ol={title:"Add 1 object to an array",run:()=>{au(1)}},sl={title:"Add 10 objects to an array",run:()=>{au(10)}},ul={title:"Add 100 objects to an array",run:()=>{au(100)}},ll={title:"Add 1,000 objects to an array",run:()=>{au(1e3)}},cl={title:"Add 10,000 objects to an array",run:()=>{au(1e4)}},fl={title:"Add 100,000 objects to an array",run:()=>{au(1e5)}},pl={title:"Get a snapshot of a model",run:()=>{Or(Fa.model({string:Fa.string,number:Fa.number,integer:Fa.integer,float:Fa.float,boolean:Fa.boolean,date:Fa.Date}).create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}))}},dl={title:"Define and create a model with an onSnapshot listener",run:()=>{mr(Fa.model({string:Fa.string,number:Fa.number,integer:Fa.integer,float:Fa.float,boolean:Fa.boolean,date:Fa.Date}).create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}),(e=>e))}},hl={title:"Execute a simple onSnapshot listener from an action",run:()=>{(()=>{const e=Fa.model({string:Fa.string,number:Fa.number,integer:Fa.integer,float:Fa.float,boolean:Fa.boolean,date:Fa.Date}).actions((e=>({changeString:t=>{e.string=t}}))).create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date});mr(e,(e=>e)),e.changeString("newString")})()}},bl={title:"Apply a snapshot to a model",run:()=>{(()=>{const e=Fa.model({string:Fa.string,number:Fa.number,integer:Fa.integer,float:Fa.float,boolean:Fa.boolean,date:Fa.Date}).create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date});wr(e,Or(e))})()}},vl={title:"Apply a snapshot to a model with a listener",run:()=>{(()=>{const e=Fa.model({string:Fa.string,number:Fa.number,integer:Fa.integer,float:Fa.float,boolean:Fa.boolean,date:Fa.Date}).create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date});mr(e,(e=>e)),wr(e,Or(e))})()}},yl={title:"Refine a reference and succeed",run:()=>{(()=>{const e=Fa.model("Car",{id:Fa.refinement(Fa.identifier,(e=>0===e.indexOf("Car_")))});Fa.model("CarStore",{cars:Fa.array(e),selectedCar:Fa.reference(e)}).create({cars:[{id:"Car_47"}],selectedCar:"Car_47"}).selectedCar.id})()}},gl={title:"Refine a reference and fail",run:()=>{(()=>{const e=Fa.model("Car",{id:Fa.refinement(Fa.identifier,(e=>0===e.indexOf("Car_")))});Fa.model("CarStore",{cars:Fa.array(e),selectedCar:Fa.reference(e)}).create({cars:[{id:"47"}],selectedCar:"47"}).selectedCar.id})()}},ml={title:"Check if reference is valid and fail",run:()=>{(()=>{const e=Fa.model("Car",{id:Fa.identifier}),t=Fa.model("CarStore",{cars:Fa.array(e),selectedCar:Fa.reference(e)}).create({cars:[{id:"47"}],selectedCar:"47"});wr(t,{...t,selectedCar:"48"}),Sr((()=>t.selectedCar))})()}},_l={title:"Check if reference is valid and succeed",run:()=>{(()=>{const e=Fa.model("Car",{id:Fa.identifier}),t=Fa.model("CarStore",{cars:Fa.array(e),selectedCar:Fa.reference(e)}).create({cars:[{id:"47"}],selectedCar:"47"});Sr((()=>t.selectedCar))})()}},wl={title:"Try reference and fail",run:()=>{(()=>{const e=Fa.model("Car",{id:Fa.identifier}),t=Fa.model("CarStore",{cars:Fa.array(e),selectedCar:Fa.maybe(Fa.reference(e))}).create({cars:[{id:"47"}],selectedCar:"47"});wr(t,{...t,selectedCar:"48"}),Pr((()=>t.selectedCar))})()}},Ol={title:"Try reference and succeed",run:()=>{(()=>{const e=Fa.model("Car",{id:Fa.identifier}),t=Fa.model("CarStore",{cars:Fa.array(e),selectedCar:Fa.maybe(Fa.reference(e))}).create({cars:[{id:"47"}],selectedCar:"47"});Pr((()=>t.selectedCar))})()}},jl={title:"Attach a patch listener to a model",run:()=>{var e,t;e=ou.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}),t=e=>e,si(),ui(e).onPatch(t)}},Pl={title:"Execute a simple patch from an action",run:()=>{_r(ou.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}),{op:"replace",path:"/string",value:"new string"})}},Sl={title:"Attach middleware",run:()=>{const e=Fa.model({task:Fa.string});Wr(Fa.model({todos:Fa.array(e)}).actions((e=>({add(t){e.todos.push(t)}}))).create({todos:[]}),(()=>{}))}},xl={title:"Attach middleware and use it",run:()=>{const e=Fa.model({task:Fa.string}),t=Fa.model({todos:Fa.array(e)}).actions((e=>({add(t){e.todos.push(t)}}))).create({todos:[]});Wr(t,((e,t)=>{t(e)})),t.add({task:"string"})}};var Al=new(n(215).Suite);const Cl={},kl=(e,t)=>{Cl[e]?Cl[e]=Math.max(Cl[e],t):Cl[e]=t};Al.on("complete",(function(){const e=Al.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Cl[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>console.log(`${e.scenario},${e.opsSec},${e.plusMinus},${e.runs},${e.maxMemory}`)))}));for(const t in e){const{title:n,run:r}=e[t];Al.add(n,(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;r();const t=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;kl(n,t-e)}))}Al.run()})()})(); \ No newline at end of file diff --git a/build/index.node.bundle.js.LICENSE.txt b/build/index.node.bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/index.node.bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/index.web.bundle.js b/build/index.web.bundle.js new file mode 100644 index 0000000..8f9c9dd --- /dev/null +++ b/build/index.web.bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see index.web.bundle.js.LICENSE.txt */ +(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var a,o={function:!0,object:!0},s=o[typeof window]&&window||this,u=(n.amdD,o[typeof t]&&t&&!t.nodeType&&t),l=o.object&&e&&!e.nodeType&&e,c=u&&l&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(s=c);var f=0,p=(l&&l.exports,/^(?:boolean|number|string|undefined)$/),d=0,h=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],b={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||Y("lodash")||s._;if(!t)return B.runInContext=g,B;(e=e?t.defaults(s.Object(),e,t.pick(s,h)):s).Array;var r=e.Date,i=e.Function,o=e.Math,l=e.Object,c=(e.RegExp,e.String),m=[],_=l.prototype,w=o.abs,O=e.clearTimeout,j=o.floor,P=(o.log,o.max),S=o.min,x=o.pow,A=m.push,C=(e.setTimeout,m.shift),k=m.slice,T=o.sqrt,E=(_.toString,m.unshift),I=Y,N=X(e,"document")&&e.document,D=I("microtime"),R=X(e,"process")&&e.process,V=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&X(e,"navigator")&&!X(e,"phantom"),z.timeout=X(e,"setTimeout")&&X(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var Z={ns:r,start:null,stop:null};function B(e,n,r){var i=this;if(!(i instanceof B))return new B(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=W(i.stats),i.times=W(i.times)}function F(e){var t=this;if(!(t instanceof F))return new F(e);t.benchmark=e,le(t)}function U(e){return e instanceof U?e:this instanceof U?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new U(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var W=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function H(){return H=function(e,t){var r,i=n.amdD?n.amdO:B,a=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+a+"=function("+e+"){"+t+"}"),r=i[a],delete i[a],r},(H=z.browser&&(H("",'return"'+M+'"')||t.noop)()==M?H:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function G(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function q(e){var n="";return J(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function X(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function J(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function Y(e){try{var t=u&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:B,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],a=i.parentNode,o=M+"runScript",s="("+(n.amdD?"define.amd.":"Benchmark.")+o+"||function(){})();";try{r.appendChild(N.createTextNode(s+e)),t[o]=function(){var e;e=r,V.appendChild(e),V.innerHTML=""}}catch(t){a=a.cloneNode(!1),i=null,r.text=e}a.insertBefore(r,i),delete t[o]}function ee(e,n){n=e.options=t.assign({},W(e.constructor.options),W(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=W(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,o,s=-1,u={currentTarget:e},l={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,o=d(i);return o&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[s]=t.isFunction(i&&i[n])?i[n].apply(i,r):a,!o&&p()}function p(t){var n,r=i,a=d(r);if(a&&(r.off("complete",p),r.emit("complete")),u.type="cycle",u.target=r,n=U(u),l.onCycle.call(e,n),n.aborted||!1===h())u.type="complete",l.onComplete.call(e,U(u));else if(d(i=o?e[0]:c[s]))K(i,f);else{if(!a)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function d(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof B&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function h(){return s++,o&&s>0&&C.call(e),(o?e.length:s>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(o?e:t+r+e)})),i.join(n||",")}function ae(e){var n,r=this,i=U(e),a=r.events,o=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,a&&(n=t.has(a,i.type)&&a[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,o))&&(i.cancelled=!0),!i.aborted})),i.result}function oe(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function se(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var a;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(a=t.indexOf(e,n))>-1&&e.splice(a,1):e.length=0)})),r):r}function ue(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function le(){var n=B.options,r={},i=[{ns:Z.ns,res:P(.0015,o("ms")),unit:"ms"}];function a(e,n,i,a){var o=e.fn,u=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(o)||"deferred":"";return r.uid=M+d++,t.assign(r,{setup:n?q(e.setup):s("m#.setup()"),fn:n?q(o):s("m#.fn("+u+")"),fnArg:u,teardown:n?q(e.teardown):s("m#.teardown()")}),"ns"==Z.unit?t.assign(r,{begin:s("s#=n#()"),end:s("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==Z.unit?Z.ns.stop?t.assign(r,{begin:s("s#=n#.start()"),end:s("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:s("s#=n#()"),end:s("r#=(n#()-s#)/1e6")}):Z.ns.now?t.assign(r,{begin:s("s#=n#.now()"),end:s("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:s("s#=new n#().getTime()"),end:s("r#=(new n#().getTime()-s#)/1e3")}),Z.start=H(s("o#"),s("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),Z.stop=H(s("o#"),s("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),H(s("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+s(a))}function o(e){for(var t,n,r=30,i=1e3,a=Z.ns,o=[];r--;){if("us"==e)if(i=1e6,a.stop)for(a.start();!(t=a.microseconds()););else for(n=a();!(t=a()-n););else if("ns"==e){for(i=1e9,n=(n=a())[0]+n[1]/i;!(t=(t=a())[0]+t[1]/i-n););i=1}else if(a.now)for(n=a.now();!(t=a.now()-n););else for(n=(new a).getTime();!(t=(new a).getTime()-n););if(!(t>0)){o.push(1/0);break}o.push(t)}return G(o)/i}function s(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}le=function(i){var o;i instanceof F&&(i=(o=i).benchmark);var s=i._original,u=J(s.fn),l=s.count=i.count,f=u||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=s.id,d=s.name||("number"==typeof p?"":p),h=0;i.minTime=s.minTime||(s.minTime=s.options.minTime=n.minTime);var b=o?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=s.compiled=i.compiled=a(s,f,o,b),y=!(r.fn||u);try{if(y)throw new Error('The test "'+d+'" is empty. This may be the result of dead code removal.');o||(s.count=1,v=f&&(v.call(s,e,Z)||{}).uid==r.uid&&v,s.count=l)}catch(e){v=null,i.error=e||new Error(c(e)),s.count=l}if(!v&&!o&&!y){v=a(s,f,o,b=(u||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{s.count=1,v.call(s,e,Z),s.count=l,delete i.error}catch(e){s.count=l,i.error||(i.error=e||new Error(c(e)))}}return i.error||(h=(v=s.compiled=i.compiled=a(s,f,o,b)).call(o||s,e,Z).elapsed),h};try{(Z.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:Z.ns,res:o("us"),unit:"us"})}catch(e){}if(R&&"function"==typeof(Z.ns=R.hrtime)&&i.push({ns:Z.ns,res:o("ns"),unit:"ns"}),D&&"function"==typeof(Z.ns=D.now)&&i.push({ns:Z.ns,res:o("us"),unit:"us"}),(Z=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(Z.res/2/.01,.05)),le.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof F&&(r=t,t=t.benchmark);var i,a,s,u,l,c,f=n.async,p=t._original,d=t.count,h=t.times;t.running&&(a=++t.cycles,i=r?r.elapsed:le(t),l=t.minTime,a>p.cycles&&(p.cycles=a),t.error&&((u=U("error")).message=t.error,t.emit(u),u.cancelled||t.abort())),t.running&&(p.times.cycle=h.cycle=i,c=p.times.period=h.period=i/d,p.hz=t.hz=1/c,p.initCount=t.initCount=d,t.running=ie?0:n30?(n=function(e){return(e-a*o/2)/T(a*o*(a+o+1)/12)}(f),w(n)>1.96?f==l?1:-1:0):f<=(s<5||u<3?0:y[s][u-3])?f==l?1:-1:0},emit:ae,listeners:oe,off:se,on:ue,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],o=[],s={destination:e,source:t.assign({},W(e.constructor.prototype),W(e.options))};do{t.forOwn(s.source,(function(e,n){var r,u=s.destination,l=u[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(l)||(r=!0,l=[]),l.length!=e.length&&(r=!0,(l=l.slice(0,e.length)).length=e.length)):t.isObjectLike(l)||(r=!0,l={}),r&&i.push({destination:u,key:n,value:l}),o.push({destination:l,source:e})):t.eq(l,e)||e===a||i.push({destination:u,key:n,value:e}))}))}while(s=o[r++]);return i.length&&(e.emit(n=U("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=U("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?F(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,a=e.initCount,s=e.minSamples,u=[],l=e.stats.sample;function c(){u.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(u,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,d,h,b,y,g=n.target,m=e.aborted,_=t.now(),w=l.push(g.times.period),O=w>=s&&(i+=_-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(m||g.hz==1/0)&&(O=!(w=l.length=u.length=0)),m||(f=G(l),y=t.reduce(l,(function(e,t){return e+x(t-f,2)}),0)/(w-1)||0,r=w-1,d=(p=(b=(h=T(y))/T(w))*(v[o.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:h,mean:f,moe:p,rme:d,sem:b,variance:y}),O&&(e.initCount=a,e.running=!1,m=!0,j.elapsed=(_-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),u.length<2&&!O&&c(),n.aborted=m},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,a=e.stats,o=a.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+a.rme.toFixed(2)+"% ("+o+" run"+(1==o?"":"s")+" sampled)")}}),t.assign(F.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(F.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,a="Expected a function",o="__lodash_hash_undefined__",s="__lodash_placeholder__",u=32,l=128,c=1/0,f=9007199254740991,p=NaN,d=4294967295,h=[["ary",l],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",u],["partialRight",64],["rearg",256]],b="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",m="[object Error]",_="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",x="[object RegExp]",A="[object Set]",C="[object String]",k="[object Symbol]",T="[object WeakMap]",E="[object ArrayBuffer]",I="[object DataView]",N="[object Float32Array]",D="[object Float64Array]",R="[object Int8Array]",V="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",Z="[object Uint16Array]",B="[object Uint32Array]",F=/\b__p \+= '';/g,U=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,W=/&(?:amp|lt|gt|quot|#39);/g,H=/[&<>"']/g,K=RegExp(W.source),G=RegExp(H.source),q=/<%-([\s\S]+?)%>/g,X=/<%([\s\S]+?)%>/g,J=/<%=([\s\S]+?)%>/g,Y=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,ae=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,oe=/\{\n\/\* \[wrapped with (.+)\] \*/,se=/,? & /,ue=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,le=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,de=/^[-+]0x[0-9a-f]+$/i,he=/^0b[01]+$/i,be=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,me=/($^)/,_e=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",xe="\\ufe0e\\ufe0f",Ae="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ce="["+we+"]",ke="["+Ae+"]",Te="["+Oe+"]",Ee="\\d+",Ie="["+je+"]",Ne="["+Pe+"]",De="[^"+we+Ae+Ee+je+Pe+Se+"]",Re="\\ud83c[\\udffb-\\udfff]",Ve="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Ze="\\u200d",Be="(?:"+Ne+"|"+De+")",Fe="(?:"+ze+"|"+De+")",Ue="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",We="(?:"+Te+"|"+Re+")?",He="["+xe+"]?",Ke=He+We+"(?:"+Ze+"(?:"+[Ve,Me,Le].join("|")+")"+He+We+")*",Ge="(?:"+[Ie,Me,Le].join("|")+")"+Ke,qe="(?:"+[Ve+Te+"?",Te,Me,Le,Ce].join("|")+")",Xe=RegExp("['’]","g"),Je=RegExp(Te,"g"),Ye=RegExp(Re+"(?="+Re+")|"+qe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+Ue+"(?="+[ke,ze,"$"].join("|")+")",Fe+"+"+$e+"(?="+[ke,ze+Be,"$"].join("|")+")",ze+"?"+Be+"+"+Ue,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ee,Ge].join("|"),"g"),et=RegExp("["+Ze+we+Oe+xe+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[D]=it[R]=it[V]=it[M]=it[L]=it[z]=it[Z]=it[B]=!0,it[b]=it[v]=it[E]=it[y]=it[I]=it[g]=it[m]=it[_]=it[O]=it[j]=it[P]=it[x]=it[A]=it[C]=it[T]=!1;var at={};at[b]=at[v]=at[E]=at[I]=at[y]=at[g]=at[N]=at[D]=at[R]=at[V]=at[M]=at[O]=at[j]=at[P]=at[x]=at[A]=at[C]=at[k]=at[L]=at[z]=at[Z]=at[B]=!0,at[m]=at[_]=at[T]=!1;var ot={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},st=parseFloat,ut=parseInt,lt="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=lt||ct||Function("return this")(),pt=t&&!t.nodeType&&t,dt=pt&&e&&!e.nodeType&&e,ht=dt&&dt.exports===pt,bt=ht&<.process,vt=function(){try{return dt&&dt.require&&dt.require("util").types||bt&&bt.binding&&bt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,mt=vt&&vt.isMap,_t=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,a=null==e?0:e.length;++i-1}function Tt(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+ot[e]}function rn(e){return et.test(e)}function an(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function on(e,t){return function(n){return e(t(n))}}function sn(e,t){for(var n=-1,r=e.length,i=0,a=[];++n",""":'"',"'":"'"}),hn=function e(t){var n,r=(t=null==t?ft:hn.defaults(ft.Object(),t,hn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,xe=t.String,Ae=t.TypeError,Ce=r.prototype,ke=Oe.prototype,Te=Pe.prototype,Ee=t["__core-js_shared__"],Ie=ke.toString,Ne=Te.hasOwnProperty,De=0,Re=(n=/[^.]+$/.exec(Ee&&Ee.keys&&Ee.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Ve=Te.toString,Me=Ie.call(Pe),Le=ft._,ze=Se("^"+Ie.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ze=ht?t.Buffer:i,Be=t.Symbol,Fe=t.Uint8Array,Ue=Ze?Ze.allocUnsafe:i,$e=on(Pe.getPrototypeOf,Pe),We=Pe.create,He=Te.propertyIsEnumerable,Ke=Ce.splice,Ge=Be?Be.isConcatSpreadable:i,qe=Be?Be.iterator:i,Ye=Be?Be.toStringTag:i,et=function(){try{var e=ua(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),ot=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,lt=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,dt=je.floor,bt=Pe.getOwnPropertySymbols,vt=Ze?Ze.isBuffer:i,Vt=t.isFinite,$t=Ce.join,bn=on(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,mn=t.parseInt,_n=je.random,wn=Ce.reverse,On=ua(t,"DataView"),jn=ua(t,"Map"),Pn=ua(t,"Promise"),Sn=ua(t,"Set"),xn=ua(t,"WeakMap"),An=ua(Pe,"create"),Cn=xn&&new xn,kn={},Tn=Va(On),En=Va(jn),In=Va(Pn),Nn=Va(Sn),Dn=Va(xn),Rn=Be?Be.prototype:i,Vn=Rn?Rn.valueOf:i,Mn=Rn?Rn.toString:i;function Ln(e){if(es(e)&&!Uo(e)&&!(e instanceof Fn)){if(e instanceof Bn)return e;if(Ne.call(e,"__wrapped__"))return Ma(e)}return new Bn(e)}var zn=function(){function e(){}return function(t){if(!Qo(t))return{};if(We)return We(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Zn(){}function Bn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Fn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=d,this.__views__=[]}function Un(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function or(e,t,n,r,a,o){var s,u=1&t,l=2&t,c=4&t;if(n&&(s=a?n(e,r,a,o):n(e)),s!==i)return s;if(!Qo(e))return e;var f=Uo(e);if(f){if(s=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!u)return xi(e,s)}else{var p=fa(e),d=p==_||p==w;if(Ko(e))return _i(e,u);if(p==P||p==b||d&&!a){if(s=l||d?{}:da(e),!u)return l?function(e,t){return Ai(e,ca(e),t)}(e,function(e,t){return e&&Ai(t,Es(t),e)}(s,e)):function(e,t){return Ai(e,la(e),t)}(e,nr(s,e))}else{if(!at[p])return a?e:{};s=function(e,t,n){var r,i=e.constructor;switch(t){case E:return wi(e);case y:case g:return new i(+e);case I:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case D:case R:case V:case M:case L:case z:case Z:case B:return Oi(e,n);case O:return new i;case j:case C:return new i(e);case x:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case A:return new i;case k:return r=e,Vn?Pe(Vn.call(r)):{}}}(e,p,u)}}o||(o=new Kn);var h=o.get(e);if(h)return h;o.set(e,s),as(e)?e.forEach((function(r){s.add(or(r,t,n,r,e,o))})):ts(e)&&e.forEach((function(r,i){s.set(i,or(r,t,n,i,e,o))}));var v=f?i:(c?l?ta:ea:l?Es:Ts)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(s,i,or(r,t,n,i,e,o))})),s}function sr(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var a=n[r],o=t[a],s=e[a];if(s===i&&!(a in e)||!o(s))return!1}return!0}function ur(e,t,n){if("function"!=typeof e)throw new Ae(a);return Aa((function(){e.apply(i,n)}),t)}function lr(e,t,n,r){var i=-1,a=kt,o=!0,s=e.length,u=[],l=t.length;if(!s)return u;n&&(t=Et(t,qt(n))),r?(a=Tt,o=!1):t.length>=200&&(a=Jt,o=!1,t=new Hn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Wn.prototype.clear=function(){this.size=0,this.__data__={hash:new Un,map:new(jn||$n),string:new Un}},Wn.prototype.delete=function(e){var t=oa(this,e).delete(e);return this.size-=t?1:0,t},Wn.prototype.get=function(e){return oa(this,e).get(e)},Wn.prototype.has=function(e){return oa(this,e).has(e)},Wn.prototype.set=function(e,t){var n=oa(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Hn.prototype.add=Hn.prototype.push=function(e){return this.__data__.set(e,o),this},Hn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Wn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ti(gr),fr=Ti(mr,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function dr(e,t,n){for(var r=-1,a=e.length;++r0&&n(s)?t>1?br(s,t-1,n,r,i):It(i,s):r||(i[i.length]=s)}return i}var vr=Ei(),yr=Ei(!0);function gr(e,t){return e&&vr(e,t,Ts)}function mr(e,t){return e&&yr(e,t,Ts)}function _r(e,t){return Ct(t,(function(t){return Xo(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function xr(e,t){return null!=e&&t in Pe(e)}function Ar(e,t,n){for(var a=n?Tt:kt,o=e[0].length,s=e.length,u=s,l=r(s),c=1/0,f=[];u--;){var p=e[u];u&&t&&(p=Et(p,qt(t))),c=yn(p.length,c),l[u]=!n&&(t||o>=120&&p.length>=120)?new Hn(u&&p):i}p=e[0];var d=-1,h=l[0];e:for(;++d=s?u:u*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Fr(e,t,n){for(var r=-1,i=t.length,a={};++r-1;)s!==e&&Ke.call(s,u,1),Ke.call(e,u,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==a){var a=i;ba(i)?Ke.call(e,i,1):ui(e,i)}}return e}function Wr(e,t){return e+dt(_n()*(t-e+1))}function Hr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=dt(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return Ca(ja(e,t,nu),e+"")}function Gr(e){return qn(zs(e))}function qr(e,t){var n=zs(e);return Ea(n,ar(t,0,n.length))}function Xr(e,t,n,r){if(!Qo(e))return e;for(var a=-1,o=(t=vi(t,e)).length,s=o-1,u=e;null!=u&&++aa?0:a+t),(n=n>a?a:n)<0&&(n+=a),a=t>n?0:n-t>>>0,t>>>=0;for(var o=r(a);++i>>1,o=e[a];null!==o&&!ss(o)&&(n?o<=t:o=200){var l=t?null:Hi(e);if(l)return un(l);o=!1,i=Jt,u=new Hn}else u=t?[]:s;e:for(;++r=r?e:ei(e,t,n)}var mi=ot||function(e){return ft.clearTimeout(e)};function _i(e,t){if(t)return e.slice();var n=e.length,r=Ue?Ue(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Fe(t).set(new Fe(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,a=e==e,o=ss(e),s=t!==i,u=null===t,l=t==t,c=ss(t);if(!u&&!c&&!o&&e>t||o&&s&&l&&!u&&!c||r&&s&&l||!n&&l||!a)return 1;if(!r&&!o&&!c&&e1?n[a-1]:i,s=a>2?n[2]:i;for(o=e.length>3&&"function"==typeof o?(a--,o):i,s&&va(n[0],n[1],s)&&(o=a<3?i:o,a=1),t=Pe(t);++r-1?a[o?t[s]:s]:i}}function Vi(e){return Qi((function(t){var n=t.length,r=n,o=Bn.prototype.thru;for(e&&t.reverse();r--;){var s=t[r];if("function"!=typeof s)throw new Ae(a);if(o&&!u&&"wrapper"==ra(s))var u=new Bn([],!0)}for(r=u?r:n;++r1&&_.reverse(),d&&fu))return!1;var c=o.get(e),f=o.get(t);if(c&&f)return c==t&&f==e;var p=-1,d=!0,h=2&n?new Hn:i;for(o.set(e,t),o.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(ae,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(h,(function(n){var r="_."+n[0];t&n[1]&&!kt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(oe);return t?t[1].split(se):[]}(r),n)))}function Ta(e){var t=0,n=0;return function(){var r=gn(),a=16-(r-n);if(n=r,a>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function Ea(e,t){var n=-1,r=e.length,a=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ro(e,n)}));function co(e){var t=Ln(e);return t.__chain__=!0,t}function fo(e,t){return t(e)}var po=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,a=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Fn&&ba(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:fo,args:[a],thisArg:i}),new Bn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(a)})),ho=Ci((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),bo=Ri(Ba),vo=Ri(Fa);function yo(e,t){return(Uo(e)?St:cr)(e,aa(t,3))}function go(e,t){return(Uo(e)?xt:fr)(e,aa(t,3))}var mo=Ci((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),_o=Kr((function(e,t,n){var i=-1,a="function"==typeof t,o=Wo(e)?r(e.length):[];return cr(e,(function(e){o[++i]=a?jt(t,e,n):Cr(e,t,n)})),o})),wo=Ci((function(e,t,n){rr(e,n,t)}));function Oo(e,t){return(Uo(e)?Et:Vr)(e,aa(t,3))}var jo=Ci((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Po=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&va(e,t[0],t[1])?t=[]:n>2&&va(t[0],t[1],t[2])&&(t=[t[0]]),Br(e,br(t,1),[])})),So=lt||function(){return ft.Date.now()};function xo(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,Gi(e,l,i,i,i,i,t)}function Ao(e,t){var n;if("function"!=typeof t)throw new Ae(a);return e=ds(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Co=Kr((function(e,t,n){var r=1;if(n.length){var i=sn(n,ia(Co));r|=u}return Gi(e,r,t,n,i)})),ko=Kr((function(e,t,n){var r=3;if(n.length){var i=sn(n,ia(ko));r|=u}return Gi(t,r,e,n,i)}));function To(e,t,n){var r,o,s,u,l,c,f=0,p=!1,d=!1,h=!0;if("function"!=typeof e)throw new Ae(a);function b(t){var n=r,a=o;return r=o=i,f=t,u=e.apply(a,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||d&&e-f>=s}function y(){var e=So();if(v(e))return g(e);l=Aa(y,function(e){var n=t-(e-c);return d?yn(n,s-(e-f)):n}(e))}function g(e){return l=i,h&&r?b(e):(r=o=i,u)}function m(){var e=So(),n=v(e);if(r=arguments,o=this,c=e,n){if(l===i)return function(e){return f=e,l=Aa(y,t),p?b(e):u}(c);if(d)return mi(l),l=Aa(y,t),b(c)}return l===i&&(l=Aa(y,t)),u}return t=bs(t)||0,Qo(n)&&(p=!!n.leading,s=(d="maxWait"in n)?vn(bs(n.maxWait)||0,t):s,h="trailing"in n?!!n.trailing:h),m.cancel=function(){l!==i&&mi(l),f=0,r=c=o=l=i},m.flush=function(){return l===i?u:g(So())},m}var Eo=Kr((function(e,t){return ur(e,1,t)})),Io=Kr((function(e,t,n){return ur(e,bs(t)||0,n)}));function No(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Ae(a);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(No.Cache||Wn),n}function Do(e){if("function"!=typeof e)throw new Ae(a);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}No.Cache=Wn;var Ro=yi((function(e,t){var n=(t=1==t.length&&Uo(t[0])?Et(t[0],qt(aa())):Et(br(t,1),qt(aa()))).length;return Kr((function(r){for(var i=-1,a=yn(r.length,n);++i=t})),Fo=kr(function(){return arguments}())?kr:function(e){return es(e)&&Ne.call(e,"callee")&&!He.call(e,"callee")},Uo=r.isArray,$o=yt?qt(yt):function(e){return es(e)&&jr(e)==E};function Wo(e){return null!=e&&Yo(e.length)&&!Xo(e)}function Ho(e){return es(e)&&Wo(e)}var Ko=vt||bu,Go=gt?qt(gt):function(e){return es(e)&&jr(e)==g};function qo(e){if(!es(e))return!1;var t=jr(e);return t==m||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!rs(e)}function Xo(e){if(!Qo(e))return!1;var t=jr(e);return t==_||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Jo(e){return"number"==typeof e&&e==ds(e)}function Yo(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qo(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function es(e){return null!=e&&"object"==typeof e}var ts=mt?qt(mt):function(e){return es(e)&&fa(e)==O};function ns(e){return"number"==typeof e||es(e)&&jr(e)==j}function rs(e){if(!es(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Ie.call(n)==Me}var is=_t?qt(_t):function(e){return es(e)&&jr(e)==x},as=wt?qt(wt):function(e){return es(e)&&fa(e)==A};function os(e){return"string"==typeof e||!Uo(e)&&es(e)&&jr(e)==C}function ss(e){return"symbol"==typeof e||es(e)&&jr(e)==k}var us=Ot?qt(Ot):function(e){return es(e)&&Yo(e.length)&&!!it[jr(e)]},ls=Ui(Rr),cs=Ui((function(e,t){return e<=t}));function fs(e){if(!e)return[];if(Wo(e))return os(e)?fn(e):xi(e);if(qe&&e[qe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[qe]());var t=fa(e);return(t==O?an:t==A?un:zs)(e)}function ps(e){return e?(e=bs(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function ds(e){var t=ps(e),n=t%1;return t==t?n?t-n:t:0}function hs(e){return e?ar(ds(e),0,d):0}function bs(e){if("number"==typeof e)return e;if(ss(e))return p;if(Qo(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qo(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Gt(e);var n=he.test(e);return n||ve.test(e)?ut(e.slice(2),n?2:8):de.test(e)?p:+e}function vs(e){return Ai(e,Es(e))}function ys(e){return null==e?"":oi(e)}var gs=ki((function(e,t){if(_a(t)||Wo(t))Ai(t,Ts(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),ms=ki((function(e,t){Ai(t,Es(t),e)})),_s=ki((function(e,t,n,r){Ai(t,Es(t),e,r)})),ws=ki((function(e,t,n,r){Ai(t,Ts(t),e,r)})),Os=Qi(ir),js=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,a=r>2?t[2]:i;for(a&&va(t[0],t[1],a)&&(r=1);++n1),t})),Ai(e,ta(e),n),r&&(n=or(n,7,Ji));for(var i=t.length;i--;)ui(n,t[i]);return n})),Rs=Qi((function(e,t){return null==e?{}:function(e,t){return Fr(e,t,(function(t,n){return xs(e,n)}))}(e,t)}));function Vs(e,t){if(null==e)return{};var n=Et(ta(e),(function(e){return[e]}));return t=aa(t),Fr(e,n,(function(e,n){return t(e,n[0])}))}var Ms=Ki(Ts),Ls=Ki(Es);function zs(e){return null==e?[]:Xt(e,Ts(e))}var Zs=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Bs(t):t)}));function Bs(e){return qs(ys(e).toLowerCase())}function Fs(e){return(e=ys(e))&&e.replace(ge,en).replace(Je,"")}var Us=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$s=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Ws=Ii("toLowerCase"),Hs=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ks=Ni((function(e,t,n){return e+(n?" ":"")+qs(t)})),Gs=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),qs=Ii("toUpperCase");function Xs(e,t,n){return e=ys(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(ue)||[]}(e):e.match(t)||[]}var Js=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return qo(e)?e:new we(e)}})),Ys=Qi((function(e,t){return St(t,(function(t){t=Ra(t),rr(e,t,Co(e[t],e))})),e}));function Qs(e){return function(){return e}}var eu=Vi(),tu=Vi(!0);function nu(e){return e}function ru(e){return Nr("function"==typeof e?e:or(e,1))}var iu=Kr((function(e,t){return function(n){return Cr(n,e,t)}})),au=Kr((function(e,t){return function(n){return Cr(e,n,t)}}));function ou(e,t,n){var r=Ts(t),i=_r(t,r);null!=n||Qo(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=_r(t,Ts(t)));var a=!(Qo(n)&&"chain"in n&&!n.chain),o=Xo(e);return St(i,(function(n){var r=t[n];e[n]=r,o&&(e.prototype[n]=function(){var t=this.__chain__;if(a||t){var n=e(this.__wrapped__);return(n.__actions__=xi(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,It([this.value()],arguments))})})),e}function su(){}var uu=Zi(Et),lu=Zi(At),cu=Zi(Rt);function fu(e){return ya(e)?Ut(Ra(e)):function(e){return function(t){return wr(t,e)}}(e)}var pu=Fi(),du=Fi(!0);function hu(){return[]}function bu(){return!1}var vu,yu=zi((function(e,t){return e+t}),0),gu=Wi("ceil"),mu=zi((function(e,t){return e/t}),1),_u=Wi("floor"),wu=zi((function(e,t){return e*t}),1),Ou=Wi("round"),ju=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new Ae(a);return e=ds(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=xo,Ln.assign=gs,Ln.assignIn=ms,Ln.assignInWith=_s,Ln.assignWith=ws,Ln.at=Os,Ln.before=Ao,Ln.bind=Co,Ln.bindAll=Ys,Ln.bindKey=ko,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Uo(e)?e:[e]},Ln.chain=co,Ln.chunk=function(e,t,n){t=(n?va(e,t,n):t===i)?1:vn(ds(t),0);var a=null==e?0:e.length;if(!a||t<1)return[];for(var o=0,s=0,u=r(pt(a/t));oa?0:a+n),(r=r===i||r>a?a:ds(r))<0&&(r+=a),r=n>r?0:hs(r);n>>0)?(e=ys(e))&&("string"==typeof t||null!=t&&!is(t))&&!(t=oi(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new Ae(a);return t=null==t?0:vn(ds(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&It(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:ds(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:ds(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,aa(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,aa(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new Ae(a);return Qo(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),To(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=fo,Ln.toArray=fs,Ln.toPairs=Ms,Ln.toPairsIn=Ls,Ln.toPath=function(e){return Uo(e)?Et(e,Ra):ss(e)?[e]:xi(Da(ys(e)))},Ln.toPlainObject=vs,Ln.transform=function(e,t,n){var r=Uo(e),i=r||Ko(e)||us(e);if(t=aa(t,4),null==n){var a=e&&e.constructor;n=i?r?new a:[]:Qo(e)&&Xo(a)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return xo(e,1)},Ln.union=Qa,Ln.unionBy=eo,Ln.unionWith=to,Ln.uniq=function(e){return e&&e.length?si(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?si(e,aa(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?si(e,i,t):[]},Ln.unset=function(e,t){return null==e||ui(e,t)},Ln.unzip=no,Ln.unzipWith=ro,Ln.update=function(e,t,n){return null==e?e:li(e,t,bi(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:li(e,t,bi(n),r)},Ln.values=zs,Ln.valuesIn=function(e){return null==e?[]:Xt(e,Es(e))},Ln.without=io,Ln.words=Xs,Ln.wrap=function(e,t){return Vo(bi(t),e)},Ln.xor=ao,Ln.xorBy=oo,Ln.xorWith=so,Ln.zip=uo,Ln.zipObject=function(e,t){return di(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return di(e||[],t||[],Xr)},Ln.zipWith=lo,Ln.entries=Ms,Ln.entriesIn=Ls,Ln.extend=ms,Ln.extendWith=_s,ou(Ln,Ln),Ln.add=yu,Ln.attempt=Js,Ln.camelCase=Zs,Ln.capitalize=Bs,Ln.ceil=gu,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=bs(n))==n?n:0),t!==i&&(t=(t=bs(t))==t?t:0),ar(bs(e),t,n)},Ln.clone=function(e){return or(e,4)},Ln.cloneDeep=function(e){return or(e,5)},Ln.cloneDeepWith=function(e,t){return or(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return or(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||sr(e,t,Ts(t))},Ln.deburr=Fs,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=mu,Ln.endsWith=function(e,t,n){e=ys(e),t=oi(t);var r=e.length,a=n=n===i?r:ar(ds(n),0,r);return(n-=t.length)>=0&&e.slice(n,a)==t},Ln.eq=zo,Ln.escape=function(e){return(e=ys(e))&&G.test(e)?e.replace(H,tn):e},Ln.escapeRegExp=function(e){return(e=ys(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Uo(e)?At:pr;return n&&va(e,t,n)&&(t=i),r(e,aa(t,3))},Ln.find=bo,Ln.findIndex=Ba,Ln.findKey=function(e,t){return Mt(e,aa(t,3),gr)},Ln.findLast=vo,Ln.findLastIndex=Fa,Ln.findLastKey=function(e,t){return Mt(e,aa(t,3),mr)},Ln.floor=_u,Ln.forEach=yo,Ln.forEachRight=go,Ln.forIn=function(e,t){return null==e?e:vr(e,aa(t,3),Es)},Ln.forInRight=function(e,t){return null==e?e:yr(e,aa(t,3),Es)},Ln.forOwn=function(e,t){return e&&gr(e,aa(t,3))},Ln.forOwnRight=function(e,t){return e&&mr(e,aa(t,3))},Ln.get=Ss,Ln.gt=Zo,Ln.gte=Bo,Ln.has=function(e,t){return null!=e&&pa(e,t,Sr)},Ln.hasIn=xs,Ln.head=$a,Ln.identity=nu,Ln.includes=function(e,t,n,r){e=Wo(e)?e:zs(e),n=n&&!r?ds(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),os(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:ds(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=ps(t),n===i?(n=t,t=0):n=ps(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=as,Ln.isString=os,Ln.isSymbol=ss,Ln.isTypedArray=us,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return es(e)&&fa(e)==T},Ln.isWeakSet=function(e){return es(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Us,Ln.last=Ga,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var a=r;return n!==i&&(a=(a=ds(n))<0?vn(r+a,0):yn(a,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,a):Lt(e,Bt,a,!0)},Ln.lowerCase=$s,Ln.lowerFirst=Ws,Ln.lt=ls,Ln.lte=cs,Ln.max=function(e){return e&&e.length?dr(e,nu,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?dr(e,aa(t,2),Pr):i},Ln.mean=function(e){return Ft(e,nu)},Ln.meanBy=function(e,t){return Ft(e,aa(t,2))},Ln.min=function(e){return e&&e.length?dr(e,nu,Rr):i},Ln.minBy=function(e,t){return e&&e.length?dr(e,aa(t,2),Rr):i},Ln.stubArray=hu,Ln.stubFalse=bu,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wu,Ln.nth=function(e,t){return e&&e.length?Zr(e,ds(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=su,Ln.now=So,Ln.pad=function(e,t,n){e=ys(e);var r=(t=ds(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Bi(dt(i),n)+e+Bi(pt(i),n)},Ln.padEnd=function(e,t,n){e=ys(e);var r=(t=ds(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var a=_n();return yn(e+a*(t-e+st("1e-"+((a+"").length-1))),t)}return Wr(e,t)},Ln.reduce=function(e,t,n){var r=Uo(e)?Nt:Wt,i=arguments.length<3;return r(e,aa(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Uo(e)?Dt:Wt,i=arguments.length<3;return r(e,aa(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?va(e,t,n):t===i)?1:ds(t),Hr(ys(e),t)},Ln.replace=function(){var e=arguments,t=ys(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,a=(t=vi(t,e)).length;for(a||(a=1,e=i);++rf)return[];var n=d,r=yn(e,d);t=aa(t),e-=d;for(var i=Kt(r,t);++n=o)return e;var u=n-cn(r);if(u<1)return r;var l=s?gi(s,0,u).join(""):e.slice(0,u);if(a===i)return l+r;if(s&&(u+=l.length-u),is(a)){if(e.slice(u).search(a)){var c,f=l;for(a.global||(a=Se(a.source,ys(pe.exec(a))+"g")),a.lastIndex=0;c=a.exec(f);)var p=c.index;l=l.slice(0,p===i?u:p)}}else if(e.indexOf(oi(a),u)!=u){var d=l.lastIndexOf(a);d>-1&&(l=l.slice(0,d))}return l+r},Ln.unescape=function(e){return(e=ys(e))&&K.test(e)?e.replace(W,dn):e},Ln.uniqueId=function(e){var t=++De;return ys(e)+t},Ln.upperCase=Gs,Ln.upperFirst=qs,Ln.each=yo,Ln.eachRight=go,Ln.first=$a,ou(Ln,(vu={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vu[t]=e)})),vu),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Fn.prototype[e]=function(n){n=n===i?1:vn(ds(n),0);var r=this.__filtered__&&!t?new Fn(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,d),type:e+(r.__dir__<0?"Right":"")}),r},Fn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Fn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:aa(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Fn.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Fn.prototype[e]=function(){return this.__filtered__?new Fn(this):this[n](1)}})),Fn.prototype.compact=function(){return this.filter(nu)},Fn.prototype.find=function(e){return this.filter(e).head()},Fn.prototype.findLast=function(e){return this.reverse().find(e)},Fn.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Fn(this):this.map((function(n){return Cr(n,e,t)}))})),Fn.prototype.reject=function(e){return this.filter(Do(aa(e)))},Fn.prototype.slice=function(e,t){e=ds(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Fn(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=ds(t))<0?n.dropRight(-t):n.take(t-e)),n)},Fn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Fn.prototype.toArray=function(){return this.take(d)},gr(Fn.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),a=Ln[r?"take"+("last"==t?"Right":""):t],o=r||/^find/.test(t);a&&(Ln.prototype[t]=function(){var t=this.__wrapped__,s=r?[1]:arguments,u=t instanceof Fn,l=s[0],c=u||Uo(t),f=function(e){var t=a.apply(Ln,It([e],s));return r&&p?t[0]:t};c&&n&&"function"==typeof l&&1!=l.length&&(u=c=!1);var p=this.__chain__,d=!!this.__actions__.length,h=o&&!p,b=u&&!d;if(!o&&c){t=b?t:new Fn(this);var v=e.apply(t,s);return v.__actions__.push({func:fo,args:[f],thisArg:i}),new Bn(v,p)}return h&&b?e.apply(this,s):(v=this.thru(f),h?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ce[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Uo(i)?i:[],e)}return this[n]((function(n){return t.apply(Uo(n)?n:[],e)}))}})),gr(Fn.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(kn,r)||(kn[r]=[]),kn[r].push({name:t,func:n})}})),kn[Mi(i,2).name]=[{name:"wrapper",func:i}],Fn.prototype.clone=function(){var e=new Fn(this.__wrapped__);return e.__actions__=xi(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=xi(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=xi(this.__views__),e},Fn.prototype.reverse=function(){if(this.__filtered__){var e=new Fn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Fn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Uo(e),r=t<0,i=n?e.length:0,a=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Zn;){var r=Ma(n);r.__index__=0,r.__values__=i,t?a.__wrapped__=r:t=r;var a=r;n=n.__wrapped__}return a.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Fn){var t=e;return this.__actions__.length&&(t=new Fn(this)),(t=t.reverse()).__actions__.push({func:fo,args:[Ya],thisArg:i}),new Bn(t,this.__chain__)}return this.thru(Ya)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,qe&&(Ln.prototype[qe]=function(){return this}),Ln}();ft._=hn,(r=function(){return hn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},a=i[typeof window]&&window||this,o=i[typeof t]&&t,s=i.object&&e&&!e.nodeType&&e,u=o&&s&&"object"==typeof n.g&&n.g;!u||u.global!==u&&u.window!==u&&u.self!==u||(a=u);var l=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,d=f.toString;function h(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function b(e){return e=_(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:h(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?h(e):d.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function m(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=l)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==F?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[s]),"IE"==z&&(s=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",F="Windows Phone "+(/\+$/.test(s)?s:s+".x"),D.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",F="Windows Phone 8.x",D.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(s=/\brv:([\d.]+)/.exec(t))&&(z&&D.push("identifying as "+z+(M?" "+M:"")),z="IE",M=s[1]),V){if(f="global",p=null!=(l=n)?typeof l[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!l[f])y(s=n.runtime)==O?(z="Adobe AIR",F=s.flash.system.Capabilities.os):y(s=n.phantom)==S?(z="PhantomJS",M=(s=s.version||null)&&s.major+"."+s.minor+"."+s.patch):"number"==typeof T.documentMode&&(s=/\bTrident\/(\d+)/i.exec(t))?(M=[M,T.documentMode],(s=+s[1]+4)!=M[1]&&(D.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=s),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof T.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(D.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],F="Windows");else if(x&&(N=(s=x.lang.System).getProperty("os.arch"),F=F||s.getProperty("os.name")+" "+s.getProperty("os.version")),A){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(s=n.system)&&s.global.system==n.system&&(z="Narwhal",F||(F=s[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(s=n.process)&&("object"==typeof s.versions&&("string"==typeof s.versions.electron?(D.push("Node "+s.versions.node),z="Electron",M=s.versions.electron):"string"==typeof s.versions.nw&&(D.push("Chromium "+M,"Node "+s.versions.node),z="NW.js",M=s.versions.nw)),z||(z="Node.js",N=s.arch,F=s.platform,M=(M=/[\d.]+/.exec(s.version))?M[0]:null));F=F&&b(F)}if(M&&(s=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(V&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(R=/b/i.test(s)?"beta":"alpha",M=M.replace(RegExp(s+"\\+?$"),"")+("beta"==R?k:C)+(/\d+\+?/.exec(s)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(F))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(Z))"Xbox 360"==Z&&(F=null),"Xbox 360"==Z&&/\bIEMobile\b/.test(t)&&D.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||Z||/Browser|Mobi/.test(z))||"Windows CE"!=F&&!/Mobi/i.test(t))if("IE"==z&&V)try{null===n.external&&D.unshift("platform preview")}catch(e){D.unshift("embedded")}else(/\bBlackBerry\b/.test(Z)||/\bBB10\b/.test(t))&&(s=(RegExp(Z.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(F=((s=[s,/BB10/.test(t)])[1]?(Z=null,B="BlackBerry"):"Device Software")+" "+s[0],M=null):this!=v&&"Wii"!=Z&&(V&&E||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(F)||"IE"==z&&(F&&!/^Win/.test(F)&&M>5.5||/\bWindows XP\b/.test(F)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(s=e.call(v,t.replace(c,"")+";"))&&s.name&&(s="ing as "+s.name+((s=s.version)?" "+s:""),c.test(z)?(/\bIE\b/.test(s)&&"Mac OS"==F&&(F=null),s="identify"+s):(s="mask"+s,z=I?b(I.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(s)&&(F=null),V||(M=null)),L=["Presto"],D.push(s));else z+=" Mobile";(s=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(s=[parseFloat(s.replace(/\.(\d)$/,".0$1")),s],"Safari"==z&&"+"==s[1].slice(-1)?(z="WebKit Nightly",R="alpha",M=s[1].slice(0,-1)):M!=s[1]&&M!=(s[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),s[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==s[0]&&537.36==s[2]&&parseFloat(s[1])>=28&&"WebKit"==L&&(L=["Blink"]),V&&(h||s[1])?(L&&(L[1]="like Chrome"),s=s[1]||((s=s[0])<530?1:s<532?2:s<532.05?3:s<533?4:s<534.03?5:s<534.07?6:s<534.1?7:s<534.13?8:s<534.16?9:s<534.24?10:s<534.3?11:s<535.01?12:s<535.02?"13+":s<535.07?15:s<535.11?16:s<535.19?17:s<536.05?18:s<536.1?19:s<537.01?20:s<537.11?"21+":s<537.13?23:s<537.18?24:s<537.24?25:s<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),s=(s=s[0])<400?1:s<500?2:s<526?3:s<533?4:s<534?"4+":s<535?5:s<537?6:s<538?7:s<601?8:s<602?9:s<604?10:s<606?11:s<608?12:"12"),L&&(L[1]+=" "+(s+="number"==typeof s?".x":/[.+]/.test(s)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=s:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&D.unshift("headless")),"Opera"==z&&(s=/\bzbov|zvav$/.exec(F))?(z+=" ",D.unshift("desktop mode"),"zvav"==s?(z+="Mini",M=null):z+="Mobile",F=F.replace(RegExp(" *"+s+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(D.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(F)?(B="Apple",F="iOS 4.3+"):F=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(s=/[\d.]+$/.exec(F))&&t.indexOf("/"+s+"-")>-1&&(F=_(F.replace(s,""))),F&&-1!=F.indexOf(z)&&!RegExp(z+" OS").test(F)&&(F=F.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(F)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(s=L[L.length-1])&&D.push(s),D.length&&(D=["("+D.join("; ")+")"]),B&&Z&&Z.indexOf(B)<0&&D.push("on "+B),Z&&D.push((/^on /.test(D[D.length-1])?"":"on ")+Z),F&&(s=/ ([\d.+]+)$/.exec(F),u=s&&"/"==F.charAt(F.length-s[0].length-1),F={architecture:32,family:s&&!u?F.replace(s[0],""):F,version:s?s[1]:null,toString:function(){var e=this.version;return this.family+(e&&!u?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(s=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(F&&(F.architecture=64,F.family=F.family.replace(RegExp(" *"+s),"")),z&&(/\bWOW64\b/i.test(t)||V&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&D.unshift("32-bit")):F&&/^OS X/.test(F.family)&&"Chrome"==z&&parseFloat(M)>=39&&(F.architecture=64),t||(t=null);var W={};return W.description=t,W.layout=L&&L[0],W.manufacturer=B,W.name=z,W.prerelease=R,W.product=Z,W.ua=t,W.version=z&&M,W.os=F||{architecture:null,family:null,version:null,toString:function(){return"null"}},W.parse=e,W.toString=function(){return this.description||""},W.version&&D.unshift(M),W.name&&D.unshift(z),F&&z&&(F!=String(F).split(" ")[0]||F!=z.split(" ")[0]&&!Z)&&D.push(Z?"("+F+")":"on "+F),D.length&&(W.description=D.join(" ")),W}();a.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var a=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.loaded=!0,a.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{"use strict";var e={};function t(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;rsu,scenario10:()=>vu,scenario11:()=>yu,scenario12:()=>gu,scenario13:()=>mu,scenario14:()=>_u,scenario15:()=>wu,scenario16:()=>Ou,scenario17:()=>ju,scenario18:()=>Pu,scenario19:()=>Su,scenario2:()=>uu,scenario20:()=>xu,scenario21:()=>Au,scenario22:()=>Cu,scenario23:()=>ku,scenario24:()=>Tu,scenario25:()=>Eu,scenario26:()=>Iu,scenario27:()=>Nu,scenario28:()=>Du,scenario29:()=>Ru,scenario3:()=>lu,scenario30:()=>Vu,scenario31:()=>Mu,scenario32:()=>Lu,scenario33:()=>zu,scenario34:()=>Zu,scenario35:()=>Bu,scenario36:()=>Fu,scenario37:()=>Uu,scenario38:()=>$u,scenario39:()=>Wu,scenario4:()=>cu,scenario40:()=>Hu,scenario41:()=>Ku,scenario42:()=>Gu,scenario43:()=>qu,scenario44:()=>Xu,scenario45:()=>Ju,scenario46:()=>Yu,scenario47:()=>Qu,scenario48:()=>el,scenario49:()=>tl,scenario5:()=>fu,scenario50:()=>nl,scenario51:()=>rl,scenario52:()=>il,scenario53:()=>al,scenario54:()=>ol,scenario55:()=>sl,scenario56:()=>ul,scenario57:()=>ll,scenario58:()=>cl,scenario59:()=>fl,scenario6:()=>pu,scenario60:()=>pl,scenario61:()=>dl,scenario62:()=>hl,scenario63:()=>bl,scenario64:()=>vl,scenario65:()=>yl,scenario66:()=>gl,scenario67:()=>ml,scenario68:()=>_l,scenario69:()=>wl,scenario7:()=>du,scenario70:()=>Ol,scenario71:()=>jl,scenario72:()=>Pl,scenario73:()=>Sl,scenario74:()=>xl,scenario8:()=>hu,scenario9:()=>bu});var r={};function i(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:r}var a=Object.assign,o=Object.getOwnPropertyDescriptor,s=Object.defineProperty,u=Object.prototype,l=[];Object.freeze(l);var c={};Object.freeze(c);var f="undefined"!=typeof Proxy,p=Object.toString();function d(){f||t("Proxy not available")}function h(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var b=function(){};function v(e){return"function"==typeof e}function y(e){switch(typeof e){case"string":case"symbol":case"number":return!0}return!1}function g(e){return null!==e&&"object"==typeof e}function m(e){if(!g(e))return!1;var t=Object.getPrototypeOf(e);if(null==t)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n.toString()===p}function _(e){var t=null==e?void 0:e.constructor;return!!t&&("GeneratorFunction"===t.name||"GeneratorFunction"===t.displayName)}function w(e,t,n){s(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function O(e,t,n){s(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function j(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(e){return g(e)&&!0===e[n]}}function P(e){return e instanceof Map}function S(e){return e instanceof Set}var x=void 0!==Object.getOwnPropertySymbols,A="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:x?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function C(e){return null===e?null:"object"==typeof e?""+e:e}function k(e,t){return u.hasOwnProperty.call(e,t)}var T=Object.getOwnPropertyDescriptors||function(e){var t={};return A(e).forEach((function(n){t[n]=o(e,n)})),t};function E(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function Z(e){return Object.assign((function(t,n){B(t,n,e)}),e)}function B(e,t,n){k(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===q}(n)||(e[z][t]=n)}var F=Symbol("mobx administration"),U=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=st.inBatch?st.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return dt(this)},t.reportChanged=function(){st.inBatch&&this.batchId_===st.batchId||(st.stateVersion=st.stateVersionr&&(r=s.dependenciesState_)}for(n.length=i,e.newObserving_=null,a=t.length;a--;){var u=t[a];0===u.diffValue_&<(u,e),u.diffValue_=0}for(;i--;){var l=n[i];1===l.diffValue_&&(l.diffValue_=0,ut(l,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Ye(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)lt(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=st.trackingDerivation;return st.trackingDerivation=null,e}function tt(e){st.trackingDerivation=e}function nt(e){var t=st.allowStateReads;return st.allowStateReads=e,t}function rt(e){st.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,st=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){t(35)}),1),new at)}();function ut(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,st.pendingUnobservations.push(e))}function ft(){0===st.inBatch&&(st.batchId=st.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var bt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=We.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,st.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=st.trackingContext;if(st.trackingContext=this,Xe(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}st.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=st.trackingContext;st.trackingContext=this;var n=Je(this,e,void 0);st.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ye(this),qe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(st.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";st.suppressReactionErrors||console.error(n,e),st.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ye(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[F]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){st.inBatch>0||st.isRunningReactions||yt(mt)}function mt(){st.isRunningReactions=!0;for(var e=st.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Ve(t,n,e):y(n)?B(t,n,e?St:jt):y(t)?Z(X(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Ct=At(!1);Object.assign(Ct,jt);var kt=At(!0);function Tt(e){return Me(e.name,!1,e,this,void 0)}function Et(e){return v(e)&&!0===e.isMobxAction}function It(e,t){var n,r,i,a,o;void 0===t&&(t=c);var s,u=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;s=new bt(u,(function(){f||(f=!0,l((function(){f=!1,s.isDisposed_||s.track(p)})))}),t.onError,t.requiresObservable)}else s=new bt(u,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(s)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||s.schedule_(),s.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(kt,St),Ct.bound=Z(Pt),kt.bound=Z(xt);var Nt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Rt="onBO",Vt="onBUO";function Mt(e,t,n){return Lt(Vt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),a=v(r)?r:n,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Zt(){this.message="FLOW_CANCELLED"}Zt.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ut=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,a=Ct(r+" - runid: "+i+" - init",n).apply(this,t),o=void 0,s=new Promise((function(t,n){var s=0;function u(e){var t;o=void 0;try{t=Ct(r+" - runid: "+i+" - yield "+s++,a.next).call(a,e)}catch(e){return n(e)}c(t)}function l(e){var t;o=void 0;try{t=Ct(r+" - runid: "+i+" - yield "+s++,a.throw).call(a,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(u,l);e.then(c,n)}e=n,u(void 0)}));return s.cancel=Ct(r+" - runid: "+i+" - cancel",(function(){try{o&&$t(o);var t=a.return(void 0),n=Promise.resolve(t.value);n.then(b,b),$t(n),e(new Zt)}catch(t){e(t)}})),s};return i.isMobXFlow=!0,i}),Bt);function $t(e){v(e.cancel)&&e.cancel()}function Wt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Ht(e,t,n){var r;return In(e)||Sn(e)||Ue(e)?r=nr(e):Fn(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function Gt(e){return function(e,t){return!!e&&(void 0!==t?!!Fn(e)&&e[F].values_.has(t):Fn(e)||!!e[F]||$(e)||_t(e)||Ke(e))}(e)}function qt(e){return Fn(e)?e[F].keys_():In(e)||Rn(e)?Array.from(e.keys()):Sn(e)?e.map((function(e,t){return t})):void t(5)}function Xt(e){return Fn(e)?qt(e).map((function(t){return e[t]})):In(e)?qt(e).map((function(t){return e.get(t)})):Rn(e)?Array.from(e.values()):Sn(e)?e.slice():void t(6)}function Jt(e,n,r){if(2!==arguments.length||Rn(e))Fn(e)?e[F].set_(n,r):In(e)?e.set(n,r):Rn(e)?e.add(n):Sn(e)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&t("Invalid index: '"+n+"'"),ft(),n>=e.length&&(e.length=n+1),e[n]=r,pt()):t(8);else{ft();var i=n;try{for(var a in i)Jt(e,a,i[a])}finally{pt()}}}function Yt(e,n,r){if(Fn(e))return e[F].defineProperty_(n,r);t(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(n,a){var o,s=nn(e,n,N({},t,{onError:a}));r=function(){s(),a(new Error("WHEN_CANCELLED"))},i=function(){s(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=r,a}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var a=Ve("When-effect",t),o=It((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),a())}),n);return o}function rn(e){return e[F]}Ut.bound=Z(Ft);var an={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(e){t(13)}};function on(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function sn(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),h((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function un(e,n){var r=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),h((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,a=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return sn(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&t("Out of range: "+e);var n=this.values_.length;if(e!==n)if(e>n){for(var r=new Array(e-n),i=0;i0&&Qn(e+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=l),on(this)){var a=un(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!a)return l;t=a.removedCount,n=a.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var o=n.length-t;this.updateArrayLength_(i,o)}var s=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,s),this.dehanceValues_(s)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(e,n){var r=this.values_;if(this.legacyMode_&&e>r.length&&t(17,e,r.length),e2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function mn(e){return function(){var t=this[F];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function _n(e){return function(t,n){var r=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[F];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",mn),gn("flat",mn),gn("includes",mn),gn("indexOf",mn),gn("join",mn),gn("lastIndexOf",mn),gn("slice",mn),gn("toString",mn),gn("toLocaleString",mn),gn("every",_n),gn("filter",_n),gn("find",_n),gn("findIndex",_n),gn("flatMap",_n),gn("forEach",_n),gn("map",_n),gn("some",_n),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",bn);function Sn(e){return g(e)&&Pn(e[F])}var xn={},An="add",Cn="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var kn,Tn,En=function(){function e(e,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=xn,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||t(18),ir((function(){i.keysAtom_=W("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var n=e.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!st.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Fe(this.has_(e),G,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(on(this)){var r=un(this,{type:n?dn:An,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,on(this)&&!un(this,{type:Cn,object:this,name:e}))return!1;if(this.has_(e)){var n=ln(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:Cn,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==st.UNCHANGED){var r=ln(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:dn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Fe(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=ln(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:An,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return lr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return lr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,a=i[0],o=i[1];e.call(t,o,a,this)}},n.merge=function(e){var n=this;return In(e)&&(e=new Map(e)),en((function(){m(e)?function(e){var t=Object.keys(e);if(!x)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return u.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(t){return n.set(t,e[t])})):Array.isArray(e)?e.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(e)?(e.constructor!==Map&&t(19,e),e.forEach((function(e,t){return n.set(t,e)}))):null!=e&&t(20,e)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(e){var n=this;return en((function(){for(var r,i=function(e){if(P(e)||In(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var n=new Map;for(var r in e)n.set(r,e[r]);return n}return t(21,e)}(e),a=new Map,o=!1,s=L(n.data_.keys());!(r=s()).done;){var u=r.value;if(!i.has(u))if(n.delete(u))o=!0;else{var l=n.data_.get(u);a.set(u,l)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,d=p[0],h=p[1],b=n.data_.has(d);if(n.set(d,h),n.data_.has(d)){var v=n.data_.get(d);a.set(d,v),b||(o=!0)}}if(!o)if(n.data_.size!==a.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){n.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}n.data_=a})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return sn(this,e)},I(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),e}(),In=j("ObservableMap",En),Nn={};kn=Symbol.iterator,Tn=Symbol.toStringTag;var Dn=function(){function e(e,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[F]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||t(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=W(i.name_),e&&i.replace(e)}))}var n=e.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,on(this)&&!un(this,{type:An,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=ln(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:An,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(on(this)&&!un(this,{type:Cn,object:this,oldValue:e}))return!1;if(this.has(e)){var n=ln(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:Cn,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return lr({next:function(){var r=e;return e+=1,rGn){for(var t=Gn;t=0&&n++}e=ur(e),t=ur(t);var s="[object Array]"===o;if(!s){if("object"!=typeof e||"object"!=typeof t)return!1;var u=e.constructor,l=t.constructor;if(u!==l&&!(v(u)&&u instanceof u&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),s){if((c=e.length)!==t.length)return!1;for(;c--;)if(!sr(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!k(t,f=p[c])||!sr(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function ur(e){return Sn(e)?e.slice():P(e)||In(e)||S(e)||Rn(e)?Array.from(e.entries()):e}function lr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&t("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:F});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function dr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var hr=function(){return hr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,a=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)o.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(i)throw i.error}}return o}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==ti.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Ar);Cr.prototype.die=Ct(Cr.prototype.die);var kr,Tr,Er=1,Ir={onError:function(e){throw e}},Nr=function(e){function t(t,n,r,i,a){var o=e.call(this,t,n,r,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Er}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Te((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,n||(o.identifierCache=new ri),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var s=o._initialSnapshot[o.identifierAttribute];if(void 0===s){var u=o._childNodes[o.identifierAttribute];u&&(s=u.value)}if("string"!=typeof s&&"number"!=typeof s)throw yi("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=za(s),o.unnormalizedIdentifier=s}return n?n.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return dr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var s=br(a),u=s.next();!u.done;u=s.next())(p=u.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=ti.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=bi,this.state=ti.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=br(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=ti.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Tt?Tt((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw yi(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&Vi(e.subpath)||"",r=e.actionContext||Fr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,a="";return r&&null!=r.name&&(a=(r&&r.context&&(si(i=r.context,1),ui(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(bi),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):pi(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw yi("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=br(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw yi("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=$r(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=zi(t.path);fi(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=$r(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),xi(this.storedValue,"$treenode",this),xi(this.storedValue,"toJSON",ci)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==ti.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,a,o,s;void 0===r&&(r=c);var u,l,f,p,d=null!=(i=r.name)?i:"Reaction",h=Ct(d,r.onError?(u=r.onError,l=n,function(){try{return l.apply(this,arguments)}catch(e){u.call(this,e)}}):n),b=!r.scheduler&&!r.delay,v=Dt(r),y=!0,g=!1,m=r.compareStructural?H.structural:r.equals||H.default,_=new bt(d,(function(){y||b?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!m(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=r)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(s=r)?void 0:s.signal)}(0,(function(t){return e.emitSnapshot(t)}),Ir);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new Ci),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Fr,Ur=1;function $r(e,t,n){var r=function(){var r=Ur++,i=Fr,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ui(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Fr;Fr=e;try{return function(e,t,n){var r=new Hr(e,n);if(r.isEmpty)return Ct(n).apply(null,t.args);var i=null;return function e(t){var a=r.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fr[t.name]?e(t):(o(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Ct(n).apply(null,t.args)}(t)}(n,e,t)}finally{Fr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:ki(arguments),context:e,tree:jr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}function Wr(e,t,n){return void 0===n&&(n=!0),ui(e).addMiddleWare(t,n)}var Hr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Kr(e){return"function"==typeof e?"":oi(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Gr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",a=oi(t)?"value of type "+ui(t).type.name+":":Pi(t)?"value":"snapshot",o=n&&oi(t)&&n.is(ui(t).snapshot);return""+i+a+" "+Kr(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return zr(e)&&(e.flags&(Tr.String|Tr.Number|Tr.Integer|Tr.Boolean|Tr.Date))>0}(n)||Pi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function qr(e,t,n){return e.concat([{path:t,type:n}])}function Xr(){return hi}function Jr(e,t,n){return[{context:e,value:t,message:n}]}function Yr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Qr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&ei(e,t)}function ei(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw yi(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Kr(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Gr).join("\n ")}(e,t,n))}var ti,ni=0,ri=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:ni++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:xe.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:xe.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,xe.array([],vi));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw yi("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Xt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,a=new e,o=n.path+"/";return(r=this.cache,Fn(r)?qt(r).map((function(e){return[e,r[e]]})):In(r)?qt(r).map((function(e){return[e,r.get(e)]})):Rn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void t(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],s=t[1],u=!1,l=s.length-1;l>=0;l--){var c=s[l];c!==n&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),s.splice(l,1),s.length||i.cache.delete(r),u=!0)}u&&i.updateLastCacheModificationPerId(r)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw yi("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),e}();function ii(e,t,n,r,i){var a=li(i);if(a){if(a.parent)throw yi("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,n),a}return new Nr(e,t,n,r,i)}function ai(e,t,n,r,i){return new Cr(e,t,n,r,i)}function oi(e){return!(!e||!e.$treenode)}function si(e,t){Ei()}function ui(e){if(!oi(e))throw yi("Value "+e+" is no MST Node");return e.$treenode}function li(e){return e&&e.$treenode||null}function ci(){return ui(this).snapshot}function fi(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=oi(r)?r:this.preProcessSnapshot(r),a=this._subtype.instantiate(e,t,n,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,oi(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Bi?Jr(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=zr(e)?this._subtype:oi(e)?Or(e,!1):this.preProcessSnapshotSafe(e);return t!==Bi&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Mr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Vr),Ui="Map.put can only be used to store complex values that have an identifier type attribute";function $i(e,t){var n,r,i=e.getSubTypes();if(i===Dr)return!1;if(i){var a=wi(i);try{for(var o=br(a),s=o.next();!s.done;s=o.next())if(!$i(s.value,t))return!1}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}return e instanceof ta&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Zi||(Zi={}));var Wi=function(e){function t(t,n){return e.call(this,t,xe.ref.enhancer,n)||this}return dr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw yi("Map.put cannot be used to set empty values");if(oi(e)){var t=ui(e);if(null===t.identifier)throw yi(Ui);return this.set(t.identifier,e),e}if(ji(e)){var n=ui(this),r=n.type;if(r.identifierMode!==Zi.YES)throw yi(Ui);var i=e[r.mapIdentifierAttribute];if(!Za(i)){var a=this.put(r.getChildType().create(e,n.environment));return this.put(Or(a))}var o=za(i);return this.set(o,e),this.get(o)}throw yi("Map.put can only be used to store complex values")}}),t}(En),Hi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Zi.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Tr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return dr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),ii(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Zi.UNKNOWN){var e=[];if($i(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw yi("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Zi.YES,this.mapIdentifierAttribute=t):this.identifierMode=Zi.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Wi(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Ht(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=$r(t,e,r);xi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Xt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw yi("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ui(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(n))return null;Qr(i,a),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Qr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Zi.YES&&t instanceof Nr){var n=t.identifier;if(n!==e)throw yi("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ui(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Vi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Vi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Vi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Qr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return Oi(e)?Yr(Object.keys(e).map((function(r){return n._subType.validate(e[r],qr(t,r,n._subType))}))):Jr(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return bi}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Mr);Hi.prototype.applySnapshot=Ct(Hi.prototype.applySnapshot);var Ki=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Tr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return dr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return ii(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var a=""+i;r[a]=n.instantiate(e,a,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hr(hr({},vi),{name:this.name});return xe.array(pi(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=$r(t,e,r);xi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=oi(e)?ui(e).snapshot:e;return this._predicate(r)?Xr():Jr(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vr),va=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=hr({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return dr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Tr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw yi("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw yi("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Qr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Xr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Vr);function ma(e,t,n){return function(e,t){if("function"!=typeof t&&oi(t))throw yi("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Zr()}(0,t),new ga(e,t,n||_a)}var _a=[void 0],wa=ma(ca,void 0),Oa=ma(la,null);function ja(e){return Zr(),ya(e,wa)}var Pa=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return dr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Tr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw yi("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Xr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Dr}}),t}(Vr),Sa=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Tr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:xe.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Ct((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return dr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var a=ai(this,e,t,n,r);return this.pendingNodeList.push(a),tn((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):Si(e)?Xr():Jr(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Lr),xa=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Tr.Frozen}),n}return dr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return ai(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Si(e)?this.subType?this.subType.validate(e,t):Xr():Jr(t,e,"Value is not serializable and cannot be frozen")}}),t}(Lr),Aa=new xa,Ca=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Za(e))this.identifier=e;else{if(!oi(e))throw yi("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ui(e);if(!n.identifierAttribute)throw yi("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw yi("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=za(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,a=n.identifierCache.resolve(i,t);if(!a)throw new ka("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ka=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return dr(t,e),t}(Error),Ta=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Tr.Reference}),r}return dr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Za(e)?Xr():Jr(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;zr(e=i.type)&&(e.flags&Tr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ui(r),a=function(r,a){var o=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(a);o&&n.fireInvalidated(o,e,t,i)},o=i.registerHook(fr.beforeDetach,a),s=i.registerHook(fr.beforeDestroy,a);return function(){o(),s()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,s=o&&o.storedValue;o&&o.isAlive&&s&&((n?n.get(t,s):e.root.identifierCache.has(r.targetType,za(t)))?i=r.addTargetNodeWatcher(e,t):a||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===ti.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){a(!1)})))}}}),t}(Lr),Ea=function(e){function t(t,n){return e.call(this,t,n)||this}return dr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,a=oi(r)?(si(i=r),ui(i).identifier):r,o=new Ca(r,this.targetType),s=ai(this,e,t,n,o);return o.node=s,this.watchTargetNodeForInvalidations(s,a,void 0),s}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=oi(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(n,r),e}var o=this.instantiate(n,r,void 0,t);return e.die(),o}}),t}(Ta),Ia=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return dr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=oi(r)?this.options.set(r,e?e.storedValue:null):r,a=ai(this,e,t,n,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=oi(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var a=this.instantiate(n,r,void 0,i);return e.die(),a}}),t}(Ta);function Na(e,t){Zr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new Ia(e,{get:n.get,set:n.set},r):new Ea(e,r)}var Da=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Tr.Identifier}),r}return dr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof ta))throw yi("Identifier types can only be instantiated as direct child of a model type");return ai(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw yi("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Jr(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Xr()}}),t}(Lr),Ra=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Tr.Identifier}),t}return dr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(Da),Va=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return dr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(Da),Ma=new Ra,La=new Va;function za(e){return""+e}function Za(e){return"string"==typeof e||"number"==typeof e}var Ba=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Tr.Custom}),n}return dr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Xr();var n=this.options.getValidationMessage(e);return n?Jr(t,e,"Invalid value for type '"+this.name+"': "+n):Xr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return ai(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var a=i?this.options.fromSnapshot(t,n.root.environment):t,o=this.instantiate(n,r,void 0,a);return e.die(),o}}),t}(Lr),Fa={enumeration:function(e,t){var n="string"==typeof e?t:e,r=ya.apply(void 0,yr(n.map((function(e){return ha(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Zr(),new Ki(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?Aa:zr(e)?new xa(e):ma(Aa,e)},identifier:Ma,identifierNumber:La,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new Pa(n,"string"==typeof e?t:e)},lazy:function(e,t){return new Sa(e,t)},undefined:ca,null:la,snapshotProcessor:function(e,t,n){return Zr(),new Fi(e,t,n)}};const Ua=Fa.model({string:Fa.string,number:Fa.number,integer:Fa.integer,float:Fa.float,boolean:Fa.boolean,date:Fa.Date}).actions((e=>({setString(t){e.string=t},setNumber(t){e.number=t},setInteger(t){e.integer=t},setFloat(t){e.float=t},setBoolean(t){e.boolean=t},setDate(t){e.date=t}}))),$a=e=>{for(let t=0;te,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},e.getValidEnumValues=t=>{const n=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),r={};for(const e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(const n of e)if(t(n))return n},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(Wa||(Wa={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(Ha||(Ha={}));const Ka=Wa.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ga=e=>{switch(typeof e){case"undefined":return Ka.undefined;case"string":return Ka.string;case"number":return isNaN(e)?Ka.nan:Ka.number;case"boolean":return Ka.boolean;case"function":return Ka.function;case"bigint":return Ka.bigint;case"symbol":return Ka.symbol;case"object":return Array.isArray(e)?Ka.array:null===e?Ka.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?Ka.promise:"undefined"!=typeof Map&&e instanceof Map?Ka.map:"undefined"!=typeof Set&&e instanceof Set?Ka.set:"undefined"!=typeof Date&&e instanceof Date?Ka.date:Ka.object;default:return Ka.unknown}},qa=Wa.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Xa extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(r);else if("invalid_return_type"===i.code)r(i.returnTypeError);else if("invalid_arguments"===i.code)r(i.argumentsError);else if(0===i.path.length)n._errors.push(t(i));else{let e=n,r=0;for(;re.message)){const t={},n=[];for(const r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}Xa.create=e=>new Xa(e);const Ja=(e,t)=>{let n;switch(e.code){case qa.invalid_type:n=e.received===Ka.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case qa.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Wa.jsonStringifyReplacer)}`;break;case qa.unrecognized_keys:n=`Unrecognized key(s) in object: ${Wa.joinValues(e.keys,", ")}`;break;case qa.invalid_union:n="Invalid input";break;case qa.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Wa.joinValues(e.options)}`;break;case qa.invalid_enum_value:n=`Invalid enum value. Expected ${Wa.joinValues(e.options)}, received '${e.received}'`;break;case qa.invalid_arguments:n="Invalid function arguments";break;case qa.invalid_return_type:n="Invalid function return type";break;case qa.invalid_date:n="Invalid date";break;case qa.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Wa.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case qa.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case qa.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case qa.custom:n="Invalid input";break;case qa.invalid_intersection_types:n="Intersection results could not be merged";break;case qa.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case qa.not_finite:n="Number must be finite";break;default:n=t.defaultError,Wa.assertNever(e)}return{message:n}};let Ya=Ja;function Qa(){return Ya}const eo=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};let s="";const u=r.filter((e=>!!e)).slice().reverse();for(const e of u)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:i.message||s}};function to(e,t){const n=eo({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,Qa(),Ja].filter((e=>!!e))});e.common.issues.push(n)}class no{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const r of t){if("aborted"===r.status)return ro;"dirty"===r.status&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const e of t)n.push({key:await e.key,value:await e.value});return no.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const r of t){const{key:t,value:i}=r;if("aborted"===t.status)return ro;if("aborted"===i.status)return ro;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"===t.value||void 0===i.value&&!r.alwaysSet||(n[t.value]=i.value)}return{status:e.value,value:n}}}const ro=Object.freeze({status:"aborted"}),io=e=>({status:"dirty",value:e}),ao=e=>({status:"valid",value:e}),oo=e=>"aborted"===e.status,so=e=>"dirty"===e.status,uo=e=>"valid"===e.status,lo=e=>"undefined"!=typeof Promise&&e instanceof Promise;var co;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(co||(co={}));class fo{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const po=(e,t)=>{if(uo(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new Xa(e.common.issues);return this._error=t,this._error}}};function ho(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:i}:{errorMap:(e,t)=>"invalid_type"!==e.code?{message:t.defaultError}:void 0===t.data?{message:null!=r?r:t.defaultError}:{message:null!=n?n:t.defaultError},description:i}}class bo{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return Ga(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Ga(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new no,ctx:{common:e.parent.common,data:e.data,parsedType:Ga(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(lo(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const r={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ga(e)},i=this._parseSync({data:e,path:r.path,parent:r});return po(r,i)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ga(e)},r=this._parse({data:e,path:n.path,parent:n}),i=await(lo(r)?r:Promise.resolve(r));return po(n,i)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,r)=>{const i=e(t),a=()=>r.addIssue({code:qa.custom,...n(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then((e=>!!e||(a(),!1))):!!i||(a(),!1)}))}refinement(e,t){return this._refinement(((n,r)=>!!e(n)||(r.addIssue("function"==typeof t?t(n,r):t),!1)))}_refinement(e){return new ns({schema:this,typeName:hs.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return rs.create(this,this._def)}nullable(){return is.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Mo.create(this,this._def)}promise(){return ts.create(this,this._def)}or(e){return Zo.create([this,e],this._def)}and(e){return $o.create(this,e,this._def)}transform(e){return new ns({...ho(this._def),schema:this,typeName:hs.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new as({...ho(this._def),innerType:this,defaultValue:t,typeName:hs.ZodDefault})}brand(){return new ls({typeName:hs.ZodBranded,type:this,...ho(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new os({...ho(this._def),innerType:this,catchValue:t,typeName:hs.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return cs.create(this,e)}readonly(){return fs.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const vo=/^c[^\s-]{8,}$/i,yo=/^[a-z][a-z0-9]*$/,go=/^[0-9A-HJKMNP-TV-Z]{26}$/,mo=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,_o=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let wo;const Oo=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,jo=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;class Po extends bo{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Ka.string){const t=this._getOrReturnCtx(e);return to(t,{code:qa.invalid_type,expected:Ka.string,received:t.parsedType}),ro}const t=new no;let n;for(const o of this._def.checks)if("min"===o.kind)e.data.lengtho.value&&(n=this._getOrReturnCtx(e,n),to(n,{code:qa.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),t.dirty());else if("length"===o.kind){const r=e.data.length>o.value,i=e.data.lengthe.test(t)),{validation:t,code:qa.invalid_string,...co.errToObj(n)})}_addCheck(e){return new Po({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...co.errToObj(e)})}url(e){return this._addCheck({kind:"url",...co.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...co.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...co.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...co.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...co.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...co.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...co.errToObj(e)})}datetime(e){var t;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,...co.errToObj(null==e?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...co.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...co.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...co.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...co.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...co.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...co.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...co.errToObj(t)})}nonempty(e){return this.min(1,co.errToObj(e))}trim(){return new Po({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Po({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Po({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuer?n:r;return parseInt(e.toFixed(i).replace(".",""))%parseInt(t.toFixed(i).replace(".",""))/Math.pow(10,i)}Po.create=e=>{var t;return new Po({checks:[],typeName:hs.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...ho(e)})};class xo extends bo{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Ka.number){const t=this._getOrReturnCtx(e);return to(t,{code:qa.invalid_type,expected:Ka.number,received:t.parsedType}),ro}let t;const n=new no;for(const r of this._def.checks)"int"===r.kind?Wa.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),to(t,{code:qa.invalid_type,expected:"integer",received:"float",message:r.message}),n.dirty()):"min"===r.kind?(r.inclusive?e.datar.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),to(t,{code:qa.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):"multipleOf"===r.kind?0!==So(e.data,r.value)&&(t=this._getOrReturnCtx(e,t),to(t,{code:qa.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):"finite"===r.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),to(t,{code:qa.not_finite,message:r.message}),n.dirty()):Wa.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,co.toString(t))}gt(e,t){return this.setLimit("min",e,!1,co.toString(t))}lte(e,t){return this.setLimit("max",e,!0,co.toString(t))}lt(e,t){return this.setLimit("max",e,!1,co.toString(t))}setLimit(e,t,n,r){return new xo({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:co.toString(r)}]})}_addCheck(e){return new xo({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:co.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:co.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:co.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:co.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:co.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:co.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:co.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:co.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:co.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value"int"===e.kind||"multipleOf"===e.kind&&Wa.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.valuenew xo({checks:[],typeName:hs.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...ho(e)});class Ao extends bo{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==Ka.bigint){const t=this._getOrReturnCtx(e);return to(t,{code:qa.invalid_type,expected:Ka.bigint,received:t.parsedType}),ro}let t;const n=new no;for(const r of this._def.checks)"min"===r.kind?(r.inclusive?e.datar.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),to(t,{code:qa.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):"multipleOf"===r.kind?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),to(t,{code:qa.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):Wa.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,co.toString(t))}gt(e,t){return this.setLimit("min",e,!1,co.toString(t))}lte(e,t){return this.setLimit("max",e,!0,co.toString(t))}lt(e,t){return this.setLimit("max",e,!1,co.toString(t))}setLimit(e,t,n,r){return new Ao({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:co.toString(r)}]})}_addCheck(e){return new Ao({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:co.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:co.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:co.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:co.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:co.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value{var t;return new Ao({checks:[],typeName:hs.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...ho(e)})};class Co extends bo{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==Ka.boolean){const t=this._getOrReturnCtx(e);return to(t,{code:qa.invalid_type,expected:Ka.boolean,received:t.parsedType}),ro}return ao(e.data)}}Co.create=e=>new Co({typeName:hs.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...ho(e)});class ko extends bo{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Ka.date){const t=this._getOrReturnCtx(e);return to(t,{code:qa.invalid_type,expected:Ka.date,received:t.parsedType}),ro}if(isNaN(e.data.getTime()))return to(this._getOrReturnCtx(e),{code:qa.invalid_date}),ro;const t=new no;let n;for(const r of this._def.checks)"min"===r.kind?e.data.getTime()r.value&&(n=this._getOrReturnCtx(e,n),to(n,{code:qa.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),t.dirty()):Wa.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ko({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:co.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:co.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.valuenew ko({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:hs.ZodDate,...ho(e)});class To extends bo{_parse(e){if(this._getType(e)!==Ka.symbol){const t=this._getOrReturnCtx(e);return to(t,{code:qa.invalid_type,expected:Ka.symbol,received:t.parsedType}),ro}return ao(e.data)}}To.create=e=>new To({typeName:hs.ZodSymbol,...ho(e)});class Eo extends bo{_parse(e){if(this._getType(e)!==Ka.undefined){const t=this._getOrReturnCtx(e);return to(t,{code:qa.invalid_type,expected:Ka.undefined,received:t.parsedType}),ro}return ao(e.data)}}Eo.create=e=>new Eo({typeName:hs.ZodUndefined,...ho(e)});class Io extends bo{_parse(e){if(this._getType(e)!==Ka.null){const t=this._getOrReturnCtx(e);return to(t,{code:qa.invalid_type,expected:Ka.null,received:t.parsedType}),ro}return ao(e.data)}}Io.create=e=>new Io({typeName:hs.ZodNull,...ho(e)});class No extends bo{constructor(){super(...arguments),this._any=!0}_parse(e){return ao(e.data)}}No.create=e=>new No({typeName:hs.ZodAny,...ho(e)});class Do extends bo{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ao(e.data)}}Do.create=e=>new Do({typeName:hs.ZodUnknown,...ho(e)});class Ro extends bo{_parse(e){const t=this._getOrReturnCtx(e);return to(t,{code:qa.invalid_type,expected:Ka.never,received:t.parsedType}),ro}}Ro.create=e=>new Ro({typeName:hs.ZodNever,...ho(e)});class Vo extends bo{_parse(e){if(this._getType(e)!==Ka.undefined){const t=this._getOrReturnCtx(e);return to(t,{code:qa.invalid_type,expected:Ka.void,received:t.parsedType}),ro}return ao(e.data)}}Vo.create=e=>new Vo({typeName:hs.ZodVoid,...ho(e)});class Mo extends bo{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==Ka.array)return to(t,{code:qa.invalid_type,expected:Ka.array,received:t.parsedType}),ro;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,i=t.data.lengthr.maxLength.value&&(to(t,{code:qa.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>r.type._parseAsync(new fo(t,e,t.path,n))))).then((e=>no.mergeArray(n,e)));const i=[...t.data].map(((e,n)=>r.type._parseSync(new fo(t,e,t.path,n))));return no.mergeArray(n,i)}get element(){return this._def.type}min(e,t){return new Mo({...this._def,minLength:{value:e,message:co.toString(t)}})}max(e,t){return new Mo({...this._def,maxLength:{value:e,message:co.toString(t)}})}length(e,t){return new Mo({...this._def,exactLength:{value:e,message:co.toString(t)}})}nonempty(e){return this.min(1,e)}}function Lo(e){if(e instanceof zo){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=rs.create(Lo(r))}return new zo({...e._def,shape:()=>t})}return e instanceof Mo?new Mo({...e._def,type:Lo(e.element)}):e instanceof rs?rs.create(Lo(e.unwrap())):e instanceof is?is.create(Lo(e.unwrap())):e instanceof Wo?Wo.create(e.items.map((e=>Lo(e)))):e}Mo.create=(e,t)=>new Mo({type:e,minLength:null,maxLength:null,exactLength:null,typeName:hs.ZodArray,...ho(t)});class zo extends bo{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=Wa.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==Ka.object){const t=this._getOrReturnCtx(e);return to(t,{code:qa.invalid_type,expected:Ka.object,received:t.parsedType}),ro}const{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ro&&"strip"===this._def.unknownKeys))for(const e in n.data)i.includes(e)||a.push(e);const o=[];for(const e of i){const t=r[e],i=n.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new fo(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof Ro){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of a)o.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)a.length>0&&(to(n,{code:qa.unrecognized_keys,keys:a}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of a){const r=n.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new fo(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of o){const n=await t.key;e.push({key:n,value:await t.value,alwaysSet:t.alwaysSet})}return e})).then((e=>no.mergeObjectSync(t,e))):no.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return co.errToObj,new zo({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var r,i,a,o;const s=null!==(a=null===(i=(r=this._def).errorMap)||void 0===i?void 0:i.call(r,t,n).message)&&void 0!==a?a:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(o=co.errToObj(e).message)&&void 0!==o?o:s}:{message:s}}}:{}})}strip(){return new zo({...this._def,unknownKeys:"strip"})}passthrough(){return new zo({...this._def,unknownKeys:"passthrough"})}extend(e){return new zo({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new zo({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:hs.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new zo({...this._def,catchall:e})}pick(e){const t={};return Wa.objectKeys(e).forEach((n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])})),new zo({...this._def,shape:()=>t})}omit(e){const t={};return Wa.objectKeys(this.shape).forEach((n=>{e[n]||(t[n]=this.shape[n])})),new zo({...this._def,shape:()=>t})}deepPartial(){return Lo(this)}partial(e){const t={};return Wa.objectKeys(this.shape).forEach((n=>{const r=this.shape[n];e&&!e[n]?t[n]=r:t[n]=r.optional()})),new zo({...this._def,shape:()=>t})}required(e){const t={};return Wa.objectKeys(this.shape).forEach((n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof rs;)e=e._def.innerType;t[n]=e}})),new zo({...this._def,shape:()=>t})}keyof(){return Yo(Wa.objectKeys(this.shape))}}zo.create=(e,t)=>new zo({shape:()=>e,unknownKeys:"strip",catchall:Ro.create(),typeName:hs.ZodObject,...ho(t)}),zo.strictCreate=(e,t)=>new zo({shape:()=>e,unknownKeys:"strict",catchall:Ro.create(),typeName:hs.ZodObject,...ho(t)}),zo.lazycreate=(e,t)=>new zo({shape:e,unknownKeys:"strip",catchall:Ro.create(),typeName:hs.ZodObject,...ho(t)});class Zo extends bo{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const n=e.map((e=>new Xa(e.ctx.common.issues)));return to(t,{code:qa.invalid_union,unionErrors:n}),ro}));{let e;const r=[];for(const i of n){const n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if("valid"===a.status)return a;"dirty"!==a.status||e||(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const i=r.map((e=>new Xa(e)));return to(t,{code:qa.invalid_union,unionErrors:i}),ro}}get options(){return this._def.options}}Zo.create=(e,t)=>new Zo({options:e,typeName:hs.ZodUnion,...ho(t)});const Bo=e=>e instanceof Xo?Bo(e.schema):e instanceof ns?Bo(e.innerType()):e instanceof Jo?[e.value]:e instanceof Qo?e.options:e instanceof es?Object.keys(e.enum):e instanceof as?Bo(e._def.innerType):e instanceof Eo?[void 0]:e instanceof Io?[null]:null;class Fo extends bo{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ka.object)return to(t,{code:qa.invalid_type,expected:Ka.object,received:t.parsedType}),ro;const n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(to(t,{code:qa.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ro)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const r=new Map;for(const n of t){const t=Bo(n.shape[e]);if(!t)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const i of t){if(r.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);r.set(i,n)}}return new Fo({typeName:hs.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...ho(n)})}}function Uo(e,t){const n=Ga(e),r=Ga(t);if(e===t)return{valid:!0,data:e};if(n===Ka.object&&r===Ka.object){const n=Wa.objectKeys(t),r=Wa.objectKeys(e).filter((e=>-1!==n.indexOf(e))),i={...e,...t};for(const n of r){const r=Uo(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}if(n===Ka.array&&r===Ka.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let r=0;r{if(oo(e)||oo(r))return ro;const i=Uo(e.value,r.value);return i.valid?((so(e)||so(r))&&t.dirty(),{status:t.value,value:i.data}):(to(n,{code:qa.invalid_intersection_types}),ro)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then((([e,t])=>r(e,t))):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}$o.create=(e,t,n)=>new $o({left:e,right:t,typeName:hs.ZodIntersection,...ho(n)});class Wo extends bo{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Ka.array)return to(n,{code:qa.invalid_type,expected:Ka.array,received:n.parsedType}),ro;if(n.data.lengththis._def.items.length&&(to(n,{code:qa.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...n.data].map(((e,t)=>{const r=this._def.items[t]||this._def.rest;return r?r._parse(new fo(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(r).then((e=>no.mergeArray(t,e))):no.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new Wo({...this._def,rest:e})}}Wo.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Wo({items:e,typeName:hs.ZodTuple,rest:null,...ho(t)})};class Ho extends bo{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Ka.object)return to(n,{code:qa.invalid_type,expected:Ka.object,received:n.parsedType}),ro;const r=[],i=this._def.keyType,a=this._def.valueType;for(const e in n.data)r.push({key:i._parse(new fo(n,e,n.path,e)),value:a._parse(new fo(n,n.data[e],n.path,e))});return n.common.async?no.mergeObjectAsync(t,r):no.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,n){return new Ho(t instanceof bo?{keyType:e,valueType:t,typeName:hs.ZodRecord,...ho(n)}:{keyType:Po.create(),valueType:e,typeName:hs.ZodRecord,...ho(t)})}}class Ko extends bo{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Ka.map)return to(n,{code:qa.invalid_type,expected:Ka.map,received:n.parsedType}),ro;const r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map((([e,t],a)=>({key:r._parse(new fo(n,e,n.path,[a,"key"])),value:i._parse(new fo(n,t,n.path,[a,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of a){const r=await n.key,i=await n.value;if("aborted"===r.status||"aborted"===i.status)return ro;"dirty"!==r.status&&"dirty"!==i.status||t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of a){const r=n.key,i=n.value;if("aborted"===r.status||"aborted"===i.status)return ro;"dirty"!==r.status&&"dirty"!==i.status||t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}}Ko.create=(e,t,n)=>new Ko({valueType:t,keyType:e,typeName:hs.ZodMap,...ho(n)});class Go extends bo{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Ka.set)return to(n,{code:qa.invalid_type,expected:Ka.set,received:n.parsedType}),ro;const r=this._def;null!==r.minSize&&n.data.sizer.maxSize.value&&(to(n,{code:qa.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const i=this._def.valueType;function a(e){const n=new Set;for(const r of e){if("aborted"===r.status)return ro;"dirty"===r.status&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}const o=[...n.data.values()].map(((e,t)=>i._parse(new fo(n,e,n.path,t))));return n.common.async?Promise.all(o).then((e=>a(e))):a(o)}min(e,t){return new Go({...this._def,minSize:{value:e,message:co.toString(t)}})}max(e,t){return new Go({...this._def,maxSize:{value:e,message:co.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Go.create=(e,t)=>new Go({valueType:e,minSize:null,maxSize:null,typeName:hs.ZodSet,...ho(t)});class qo extends bo{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ka.function)return to(t,{code:qa.invalid_type,expected:Ka.function,received:t.parsedType}),ro;function n(e,n){return eo({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Qa(),Ja].filter((e=>!!e)),issueData:{code:qa.invalid_arguments,argumentsError:n}})}function r(e,n){return eo({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Qa(),Ja].filter((e=>!!e)),issueData:{code:qa.invalid_return_type,returnTypeError:n}})}const i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof ts){const e=this;return ao((async function(...t){const o=new Xa([]),s=await e._def.args.parseAsync(t,i).catch((e=>{throw o.addIssue(n(t,e)),o})),u=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(u,i).catch((e=>{throw o.addIssue(r(u,e)),o}))}))}{const e=this;return ao((function(...t){const o=e._def.args.safeParse(t,i);if(!o.success)throw new Xa([n(t,o.error)]);const s=Reflect.apply(a,this,o.data),u=e._def.returns.safeParse(s,i);if(!u.success)throw new Xa([r(s,u.error)]);return u.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new qo({...this._def,args:Wo.create(e).rest(Do.create())})}returns(e){return new qo({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new qo({args:e||Wo.create([]).rest(Do.create()),returns:t||Do.create(),typeName:hs.ZodFunction,...ho(n)})}}class Xo extends bo{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Xo.create=(e,t)=>new Xo({getter:e,typeName:hs.ZodLazy,...ho(t)});class Jo extends bo{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return to(t,{received:t.data,code:qa.invalid_literal,expected:this._def.value}),ro}return{status:"valid",value:e.data}}get value(){return this._def.value}}function Yo(e,t){return new Qo({values:e,typeName:hs.ZodEnum,...ho(t)})}Jo.create=(e,t)=>new Jo({value:e,typeName:hs.ZodLiteral,...ho(t)});class Qo extends bo{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return to(t,{expected:Wa.joinValues(n),received:t.parsedType,code:qa.invalid_type}),ro}if(-1===this._def.values.indexOf(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return to(t,{received:t.data,code:qa.invalid_enum_value,options:n}),ro}return ao(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e){return Qo.create(e)}exclude(e){return Qo.create(this.options.filter((t=>!e.includes(t))))}}Qo.create=Yo;class es extends bo{_parse(e){const t=Wa.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Ka.string&&n.parsedType!==Ka.number){const e=Wa.objectValues(t);return to(n,{expected:Wa.joinValues(e),received:n.parsedType,code:qa.invalid_type}),ro}if(-1===t.indexOf(e.data)){const e=Wa.objectValues(t);return to(n,{received:n.data,code:qa.invalid_enum_value,options:e}),ro}return ao(e.data)}get enum(){return this._def.values}}es.create=(e,t)=>new es({values:e,typeName:hs.ZodNativeEnum,...ho(t)});class ts extends bo{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ka.promise&&!1===t.common.async)return to(t,{code:qa.invalid_type,expected:Ka.promise,received:t.parsedType}),ro;const n=t.parsedType===Ka.promise?t.data:Promise.resolve(t.data);return ao(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}ts.create=(e,t)=>new ts({type:e,typeName:hs.ZodPromise,...ho(t)});class ns extends bo{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===hs.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{to(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===r.type){const e=r.transform(n.data,i);return n.common.issues.length?{status:"dirty",value:n.data}:n.common.async?Promise.resolve(e).then((e=>this._def.schema._parseAsync({data:e,path:n.path,parent:n}))):this._def.schema._parseSync({data:e,path:n.path,parent:n})}if("refinement"===r.type){const e=e=>{const t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===r.status?ro:("dirty"===r.status&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((n=>"aborted"===n.status?ro:("dirty"===n.status&&t.dirty(),e(n.value).then((()=>({status:t.value,value:n.value}))))))}if("transform"===r.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!uo(e))return e;const a=r.transform(e.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((e=>uo(e)?Promise.resolve(r.transform(e.value,i)).then((e=>({status:t.value,value:e}))):e))}Wa.assertNever(r)}}ns.create=(e,t,n)=>new ns({schema:e,typeName:hs.ZodEffects,effect:t,...ho(n)}),ns.createWithPreprocess=(e,t,n)=>new ns({schema:t,effect:{type:"preprocess",transform:e},typeName:hs.ZodEffects,...ho(n)});class rs extends bo{_parse(e){return this._getType(e)===Ka.undefined?ao(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}rs.create=(e,t)=>new rs({innerType:e,typeName:hs.ZodOptional,...ho(t)});class is extends bo{_parse(e){return this._getType(e)===Ka.null?ao(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}is.create=(e,t)=>new is({innerType:e,typeName:hs.ZodNullable,...ho(t)});class as extends bo{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===Ka.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}as.create=(e,t)=>new as({innerType:e,typeName:hs.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...ho(t)});class os extends bo{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return lo(r)?r.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new Xa(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new Xa(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}os.create=(e,t)=>new os({innerType:e,typeName:hs.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...ho(t)});class ss extends bo{_parse(e){if(this._getType(e)!==Ka.nan){const t=this._getOrReturnCtx(e);return to(t,{code:qa.invalid_type,expected:Ka.nan,received:t.parsedType}),ro}return{status:"valid",value:e.data}}}ss.create=e=>new ss({typeName:hs.ZodNaN,...ho(e)});const us=Symbol("zod_brand");class ls extends bo{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class cs extends bo{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?ro:"dirty"===e.status?(t.dirty(),io(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?ro:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new cs({in:e,out:t,typeName:hs.ZodPipeline})}}class fs extends bo{_parse(e){const t=this._def.innerType._parse(e);return uo(t)&&(t.value=Object.freeze(t.value)),t}}fs.create=(e,t)=>new fs({innerType:e,typeName:hs.ZodReadonly,...ho(t)});const ps=(e,t={},n)=>e?No.create().superRefine(((r,i)=>{var a,o;if(!e(r)){const e="function"==typeof t?t(r):"string"==typeof t?{message:t}:t,s=null===(o=null!==(a=e.fatal)&&void 0!==a?a:n)||void 0===o||o,u="string"==typeof e?{message:e}:e;i.addIssue({code:"custom",...u,fatal:s})}})):No.create(),ds={object:zo.lazycreate};var hs;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(hs||(hs={}));const bs=Po.create,vs=xo.create,ys=ss.create,gs=Ao.create,ms=Co.create,_s=ko.create,ws=To.create,Os=Eo.create,js=Io.create,Ps=No.create,Ss=Do.create,xs=Ro.create,As=Vo.create,Cs=Mo.create,ks=zo.create,Ts=zo.strictCreate,Es=Zo.create,Is=Fo.create,Ns=$o.create,Ds=Wo.create,Rs=Ho.create,Vs=Ko.create,Ms=Go.create,Ls=qo.create,zs=Xo.create,Zs=Jo.create,Bs=Qo.create,Fs=es.create,Us=ts.create,$s=ns.create,Ws=rs.create,Hs=is.create,Ks=ns.createWithPreprocess,Gs=cs.create,qs={string:e=>Po.create({...e,coerce:!0}),number:e=>xo.create({...e,coerce:!0}),boolean:e=>Co.create({...e,coerce:!0}),bigint:e=>Ao.create({...e,coerce:!0}),date:e=>ko.create({...e,coerce:!0})},Xs=ro;var Js=Object.freeze({__proto__:null,defaultErrorMap:Ja,setErrorMap:function(e){Ya=e},getErrorMap:Qa,makeIssue:eo,EMPTY_PATH:[],addIssueToContext:to,ParseStatus:no,INVALID:ro,DIRTY:io,OK:ao,isAborted:oo,isDirty:so,isValid:uo,isAsync:lo,get util(){return Wa},get objectUtil(){return Ha},ZodParsedType:Ka,getParsedType:Ga,ZodType:bo,ZodString:Po,ZodNumber:xo,ZodBigInt:Ao,ZodBoolean:Co,ZodDate:ko,ZodSymbol:To,ZodUndefined:Eo,ZodNull:Io,ZodAny:No,ZodUnknown:Do,ZodNever:Ro,ZodVoid:Vo,ZodArray:Mo,ZodObject:zo,ZodUnion:Zo,ZodDiscriminatedUnion:Fo,ZodIntersection:$o,ZodTuple:Wo,ZodRecord:Ho,ZodMap:Ko,ZodSet:Go,ZodFunction:qo,ZodLazy:Xo,ZodLiteral:Jo,ZodEnum:Qo,ZodNativeEnum:es,ZodPromise:ts,ZodEffects:ns,ZodTransformer:ns,ZodOptional:rs,ZodNullable:is,ZodDefault:as,ZodCatch:os,ZodNaN:ss,BRAND:us,ZodBranded:ls,ZodPipeline:cs,ZodReadonly:fs,custom:ps,Schema:bo,ZodSchema:bo,late:ds,get ZodFirstPartyTypeKind(){return hs},coerce:qs,any:Ps,array:Cs,bigint:gs,boolean:ms,date:_s,discriminatedUnion:Is,effect:$s,enum:Bs,function:Ls,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>ps((t=>t instanceof e),t),intersection:Ns,lazy:zs,literal:Zs,map:Vs,nan:ys,nativeEnum:Fs,never:xs,null:js,nullable:Hs,number:vs,object:ks,oboolean:()=>ms().optional(),onumber:()=>vs().optional(),optional:Ws,ostring:()=>bs().optional(),pipeline:Gs,preprocess:Ks,promise:Us,record:Rs,set:Ms,strictObject:Ts,string:bs,symbol:ws,transformer:$s,tuple:Ds,undefined:Os,union:Es,unknown:Ss,void:As,NEVER:Xs,ZodIssueCode:qa,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:Xa});const Ys=Fa.model({id:Fa.identifier,name:Fa.string,age:Fa.number,isHappy:Fa.boolean,createdAt:Fa.Date,updatedAt:Fa.maybeNull(Fa.Date),favoriteColors:Fa.array(Fa.string),favoriteNumbers:Fa.array(Fa.number),favoriteFoods:Fa.array(Fa.model({name:Fa.string,calories:Fa.number}))}),Qs=Fa.model({id:Fa.identifier,shouldMatch:!1}),eu=Js.object({id:Js.number(),name:Js.string(),age:Js.number(),isHappy:Js.boolean(),createdAt:Js.date(),updatedAt:Js.date().nullable(),favoriteColors:Js.array(Js.string()),favoriteNumbers:Js.array(Js.number()),favoriteFoods:Js.array(Js.object({name:Js.string(),calories:Js.number()}))}),tu=Fa.model({id:Fa.identifier,name:Fa.string,age:Fa.number}),nu=Fa.model({users:Fa.array(tu)}).views((e=>({get numberOfChildren(){return e.users.filter((e=>e.age<18)).length},numberOfPeopleOlderThan:t=>e.users.filter((e=>e.age>t)).length}))).create({users:[{id:"1",name:"John",age:42},{id:"2",name:"Jane",age:47}]}),ru=Fa.model({name:Fa.string,id:Fa.string}),iu=Fa.model({items:Fa.array(ru)}).actions((e=>({add(t,n){e.items.push({name:t,id:n})}}))),au=e=>{const t=iu.create({items:[]});for(let n=0;n{$a(1)}},uu={title:"Create 10 models",longDescription:"Create 10 models with all primitive types, along with a setter action for each.",run:()=>{$a(10)}},lu={title:"Create 100 models",longDescription:"Create 100 models with all primitive types, along with a setter action for each.",run:()=>{$a(100)}},cu={title:"Create 1,000 models",longDescription:"Create 1,000 models with all primitive types, along with a setter action for each.",run:()=>{$a(1e3)}},fu={title:"Create 10,000 models",longDescription:"Create 10,000 models with all primitive types, along with a setter action for each.",run:()=>{$a(1e4)}},pu={title:"Create 100,000 models",longDescription:"Create 100,000 models with all primitive types, along with a setter action for each.",run:()=>{$a(1e5)}},du={title:"Create 1 model and set a string value",longDescription:"Create 1 model with all primitive types, along with a setter action for each. Then, set a string value.",run:()=>{Ua.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}).setString("new string")}},hu={title:"Create 1 model and set a number value",longDescription:"Create 1 model with all primitive types, along with a setter action for each. Then, set a number value.",run:()=>{Ua.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}).setNumber(2)}},bu={title:"Create 1 model and set an integer value",longDescription:"Create 1 model with all primitive types, along with a setter action for each. Then, set an integer value.",run:()=>{Ua.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}).setInteger(2)}},vu={title:"Create 1 model and set a float value",longDescription:"Create 1 model with all primitive types, along with a setter action for each. Then, set a float value.",run:()=>{Ua.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}).setFloat(2.2)}},yu={title:"Create 1 model and set a boolean value",longDescription:"Create 1 model with all primitive types, along with a setter action for each. Then, set a boolean value.",run:()=>{Ua.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}).setBoolean(!1)}},gu={title:"Create 1 model and set a date value",longDescription:"Create 1 model with all primitive types, along with a setter action for each. Then, set a date value.",run:()=>{Ua.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}).setDate(new Date)}},mu={title:"Create a types.string",longDescription:"Create a types.string.",run:()=>{Fa.string.create("string")}},_u={title:"Create a types.number",longDescription:"Create a types.number.",run:()=>{Fa.number.create(1)}},wu={title:"Create a types.integer",longDescription:"Create a types.integer.",run:()=>{Fa.integer.create(1)}},Ou={title:"Create a types.float",longDescription:"Create a types.float.",run:()=>{Fa.float.create(1.1)}},ju={title:"Create a types.boolean",longDescription:"Create a types.boolean.",run:()=>{Fa.boolean.create(!0)}},Pu={title:"Create a types.Date",longDescription:"Create a types.Date.",run:()=>{Fa.Date.create(new Date)}},Su={title:"Create a types.array(types.string)",longDescription:"Create a types.array(types.string).",run:()=>{Fa.array(Fa.string).create(["string"])}},xu={title:"Create a types.array(types.number)",longDescription:"Create a types.array(types.number).",run:()=>{Fa.array(Fa.number).create([1])}},Au={title:"Create a types.array(types.integer)",longDescription:"Create a types.array(types.integer).",run:()=>{Fa.array(Fa.integer).create([1])}},Cu={title:"Create a types.array(types.float)",longDescription:"Create a types.array(types.float).",run:()=>{Fa.array(Fa.float).create([1.1])}},ku={title:"Create a types.array(types.boolean)",longDescription:"Create a types.array(types.boolean).",run:()=>{Fa.array(Fa.boolean).create([!0])}},Tu={title:"Create a types.array(types.Date)",longDescription:"Create a types.array(types.Date).",run:()=>{Fa.array(Fa.Date).create([new Date])}},Eu={title:"Create a types.map(types.string)",longDescription:"Create a types.map(types.string).",run:()=>{Fa.map(Fa.string).create({string:"string"})}},Iu={title:"Create a types.map(types.number)",longDescription:"Create a types.map(types.number).",run:()=>{Fa.map(Fa.number).create({number:1})}},Nu={title:"Create a types.map(types.integer)",longDescription:"Create a types.map(types.integer).",run:()=>{Fa.map(Fa.integer).create({integer:1})}},Du={title:"Create a types.map(types.float)",longDescription:"Create a types.map(types.float).",run:()=>{Fa.map(Fa.float).create({float:1.1})}},Ru={title:"Create a types.map(types.boolean)",longDescription:"Create a types.map(types.boolean).",run:()=>{Fa.map(Fa.boolean).create({boolean:!0})}},Vu={title:"Create a types.map(types.Date)",longDescription:"Create a types.map(types.Date).",run:()=>{Fa.map(Fa.Date).create({date:new Date})}},Mu={title:"Check a valid model with MST typecheck",run:()=>{(()=>{const e=Ys.create({id:"1",name:"John",age:42,isHappy:!0,createdAt:new Date,updatedAt:null,favoriteColors:["blue","green"],favoriteNumbers:[1,2,3],favoriteFoods:[{name:"Pizza",calories:1e3}]});ei(Ys,e)})()}},Lu={title:"Check an invalid model with MST typecheck",run:()=>{(()=>{const e=Ys.create({id:"1",name:"John",age:42,isHappy:!0,createdAt:new Date,updatedAt:null,favoriteColors:["blue","green"],favoriteNumbers:[1,2,3],favoriteFoods:[{name:"Pizza",calories:1e3}]});try{ei(Qs,e)}catch(e){return}})()}},zu={title:"Check a valid snapshot with MST typecheck",run:()=>{ei(Ys,{id:"1",name:"John",age:42,isHappy:!0,createdAt:new Date,updatedAt:null,favoriteColors:["blue","green"],favoriteNumbers:[1,2,3],favoriteFoods:[{name:"Pizza",calories:1e3}]})}},Zu={title:"Check an invalid snapshot with MST typecheck",run:()=>{(()=>{try{ei(Qs,{id:"1",name:"John",age:42,isHappy:!0,createdAt:new Date,updatedAt:null,favoriteColors:["blue","green"],favoriteNumbers:[1,2,3],favoriteFoods:[{name:"Pizza",calories:1e3}]})}catch(e){return}})()}},Bu={title:"Check a valid model with Zod typecheck",run:()=>{(()=>{const e={id:1,name:"John",age:42,isHappy:!0,createdAt:new Date,updatedAt:null,favoriteColors:["blue","green"],favoriteNumbers:[1,2,3],favoriteFoods:[{name:"Pizza",calories:1e3}]};eu.parse(e)})()}},Fu={title:"Check an invalid model with Zod typecheck",run:()=>{(()=>{const e={id:1,name:"John"};try{eu.parse(e)}catch(e){return}})()}},Uu={title:"Create a model and add actions to it",run:()=>{const e=Fa.model({string:Fa.string,number:Fa.number,integer:Fa.integer,float:Fa.float,boolean:Fa.boolean,date:Fa.Date}).actions((e=>({setString:t=>{e.string=t},setNumber:t=>{e.number=t},setInteger:t=>{e.integer=t},setFloat:t=>{e.float=t},setBoolean:t=>{e.boolean=t},setDate:t=>{e.date=t}})));e.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}).setString("new string")}},$u={title:"Create a model and add views to it",run:()=>{Fa.model({string:Fa.string,number:Fa.number,integer:Fa.integer,float:Fa.float,boolean:Fa.boolean,date:Fa.Date}).views((e=>({getString:()=>e.string,getNumber:()=>e.number,getInteger:()=>e.integer,getFloat:()=>e.float,getBoolean:()=>e.boolean,getDate:()=>e.date}))).create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}).getString()}},Wu={title:"Create a model and add both actions and views to it",run:()=>{const e=Fa.model({string:Fa.string,number:Fa.number,integer:Fa.integer,float:Fa.float,boolean:Fa.boolean,date:Fa.Date}).actions((e=>({setString:t=>{e.string=t},setNumber:t=>{e.number=t},setInteger:t=>{e.integer=t},setFloat:t=>{e.float=t},setBoolean:t=>{e.boolean=t},setDate:t=>{e.date=t}}))).views((e=>({getString:()=>e.string,getNumber:()=>e.number,getInteger:()=>e.integer,getFloat:()=>e.float,getBoolean:()=>e.boolean,getDate:()=>e.date})));e.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}).getString()}},Hu={title:"Declare a model with a reference and retrieve a value from it",run:()=>{(()=>{const e=Fa.model({id:Fa.identifier,title:Fa.string});Fa.model({todos:Fa.array(e),selectedTodo:Fa.reference(e)}).create({todos:[{id:"47",title:"Get coffee"}],selectedTodo:"47"}).selectedTodo.title})()}},Ku={title:"Add onAction to a model",run:()=>{const e=Fa.model({task:Fa.string}),t=Fa.model({todos:Fa.array(e)}).actions((e=>({add(t){e.todos.push(t)}}))).create({todos:[]});return onAction(t,(e=>{console.log(e)}))}},Gu={title:"Add middleware to an action and include hooks (default)",run:()=>{const e=Fa.model({task:Fa.string});Wr(Fa.model({todos:Fa.array(e)}).actions((e=>({add(t){e.todos.push(t)}}))).create({todos:[]}),(()=>{}))}},qu={title:"Add middleware to an action and do not include hooks",run:()=>{const e=Fa.model({task:Fa.string});Wr(Fa.model({todos:Fa.array(e)}).actions((e=>({add(t){e.todos.push(t)}}))).create({todos:[]}),(()=>{}),!1)}},Xu={title:"Create 1 model and set a string value using applyAction",run:()=>{Ua.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}),Br(Ua,{name:"setString",path:"",args:["new string"]})}},Ju={title:"Create 1 model and set a number value using applyAction",run:()=>{Ua.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}),Br(Ua,{name:"setNumber",path:"",args:[2]})}},Yu={title:"Create 1 model and set an integer value using applyAction",run:()=>{Ua.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}),Br(Ua,{name:"setInteger",path:"",args:[2]})}},Qu={title:"Create 1 model and set a float value using applyAction",run:()=>{Ua.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}),Br(Ua,{name:"setFloat",path:"",args:[2.2]})}},el={title:"Create 1 model and set a boolean value using applyAction",run:()=>{Ua.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}),Br(Ua,{name:"setBoolean",path:"",args:[!1]})}},tl={title:"Create 1 model and set a date value using applyAction",run:()=>{Ua.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}),Br(Ua,{name:"setDate",path:"",args:[new Date]})}},nl={title:"Get a computed value once",run:()=>{nu.numberOfChildren}},rl={title:"Get a computed value twice (should be cached)",run:()=>{nu.numberOfChildren,nu.numberOfChildren}},il={title:"Get a view with a parameter once",run:()=>{nu.numberOfPeopleOlderThan(50)}},al={title:"Get a view with a parameter twice (not cached)",run:()=>{nu.numberOfPeopleOlderThan(50),nu.numberOfPeopleOlderThan(50)}},ol={title:"Add 1 object to an array",run:()=>{au(1)}},sl={title:"Add 10 objects to an array",run:()=>{au(10)}},ul={title:"Add 100 objects to an array",run:()=>{au(100)}},ll={title:"Add 1,000 objects to an array",run:()=>{au(1e3)}},cl={title:"Add 10,000 objects to an array",run:()=>{au(1e4)}},fl={title:"Add 100,000 objects to an array",run:()=>{au(1e5)}},pl={title:"Get a snapshot of a model",run:()=>{Or(Fa.model({string:Fa.string,number:Fa.number,integer:Fa.integer,float:Fa.float,boolean:Fa.boolean,date:Fa.Date}).create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}))}},dl={title:"Define and create a model with an onSnapshot listener",run:()=>{mr(Fa.model({string:Fa.string,number:Fa.number,integer:Fa.integer,float:Fa.float,boolean:Fa.boolean,date:Fa.Date}).create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}),(e=>e))}},hl={title:"Execute a simple onSnapshot listener from an action",run:()=>{(()=>{const e=Fa.model({string:Fa.string,number:Fa.number,integer:Fa.integer,float:Fa.float,boolean:Fa.boolean,date:Fa.Date}).actions((e=>({changeString:t=>{e.string=t}}))).create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date});mr(e,(e=>e)),e.changeString("newString")})()}},bl={title:"Apply a snapshot to a model",run:()=>{(()=>{const e=Fa.model({string:Fa.string,number:Fa.number,integer:Fa.integer,float:Fa.float,boolean:Fa.boolean,date:Fa.Date}).create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date});wr(e,Or(e))})()}},vl={title:"Apply a snapshot to a model with a listener",run:()=>{(()=>{const e=Fa.model({string:Fa.string,number:Fa.number,integer:Fa.integer,float:Fa.float,boolean:Fa.boolean,date:Fa.Date}).create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date});mr(e,(e=>e)),wr(e,Or(e))})()}},yl={title:"Refine a reference and succeed",run:()=>{(()=>{const e=Fa.model("Car",{id:Fa.refinement(Fa.identifier,(e=>0===e.indexOf("Car_")))});Fa.model("CarStore",{cars:Fa.array(e),selectedCar:Fa.reference(e)}).create({cars:[{id:"Car_47"}],selectedCar:"Car_47"}).selectedCar.id})()}},gl={title:"Refine a reference and fail",run:()=>{(()=>{const e=Fa.model("Car",{id:Fa.refinement(Fa.identifier,(e=>0===e.indexOf("Car_")))});Fa.model("CarStore",{cars:Fa.array(e),selectedCar:Fa.reference(e)}).create({cars:[{id:"47"}],selectedCar:"47"}).selectedCar.id})()}},ml={title:"Check if reference is valid and fail",run:()=>{(()=>{const e=Fa.model("Car",{id:Fa.identifier}),t=Fa.model("CarStore",{cars:Fa.array(e),selectedCar:Fa.reference(e)}).create({cars:[{id:"47"}],selectedCar:"47"});wr(t,{...t,selectedCar:"48"}),Sr((()=>t.selectedCar))})()}},_l={title:"Check if reference is valid and succeed",run:()=>{(()=>{const e=Fa.model("Car",{id:Fa.identifier}),t=Fa.model("CarStore",{cars:Fa.array(e),selectedCar:Fa.reference(e)}).create({cars:[{id:"47"}],selectedCar:"47"});Sr((()=>t.selectedCar))})()}},wl={title:"Try reference and fail",run:()=>{(()=>{const e=Fa.model("Car",{id:Fa.identifier}),t=Fa.model("CarStore",{cars:Fa.array(e),selectedCar:Fa.maybe(Fa.reference(e))}).create({cars:[{id:"47"}],selectedCar:"47"});wr(t,{...t,selectedCar:"48"}),Pr((()=>t.selectedCar))})()}},Ol={title:"Try reference and succeed",run:()=>{(()=>{const e=Fa.model("Car",{id:Fa.identifier}),t=Fa.model("CarStore",{cars:Fa.array(e),selectedCar:Fa.maybe(Fa.reference(e))}).create({cars:[{id:"47"}],selectedCar:"47"});Pr((()=>t.selectedCar))})()}},jl={title:"Attach a patch listener to a model",run:()=>{var e,t;e=ou.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}),t=e=>e,si(),ui(e).onPatch(t)}},Pl={title:"Execute a simple patch from an action",run:()=>{_r(ou.create({string:"string",number:1,integer:1,float:1.1,boolean:!0,date:new Date}),{op:"replace",path:"/string",value:"new string"})}},Sl={title:"Attach middleware",run:()=>{const e=Fa.model({task:Fa.string});Wr(Fa.model({todos:Fa.array(e)}).actions((e=>({add(t){e.todos.push(t)}}))).create({todos:[]}),(()=>{}))}},xl={title:"Attach middleware and use it",run:()=>{const e=Fa.model({task:Fa.string}),t=Fa.model({todos:Fa.array(e)}).actions((e=>({add(t){e.todos.push(t)}}))).create({todos:[]});Wr(t,((e,t)=>{t(e)})),t.add({task:"string"})}};var Al=new(n(215).Suite);const Cl={},kl=(e,t)=>{Cl[e]?Cl[e]=Math.max(Cl[e],t):Cl[e]=t};Al.on("complete",(function(){const e=Al.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Cl[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>console.log(`${e.scenario},${e.opsSec},${e.plusMinus},${e.runs},${e.maxMemory}`)))}));for(const t in e){const{title:n,run:r}=e[t];Al.add(n,(()=>{const e=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;r();const t=void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;kl(n,t-e)}))}Al.run()})()})(); \ No newline at end of file diff --git a/build/index.web.bundle.js.LICENSE.txt b/build/index.web.bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/index.web.bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/refine-a-reference-and-fail-bundle-source.js b/build/refine-a-reference-and-fail-bundle-source.js new file mode 100644 index 0000000..c673874 --- /dev/null +++ b/build/refine-a-reference-and-fail-bundle-source.js @@ -0,0 +1,107 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Refine a reference and fail", () => { + const startMemory = getStartMemory(); + const Car = types.model("Car", { + id: types.refinement( + types.identifier, + (identifier) => identifier.indexOf("Car_") === 0 + ), +}); + +const CarStore = types.model("CarStore", { + cars: types.array(Car), + selectedCar: types.reference(Car), +}); + +// create a store with a normalized snapshot +const storeInstance = CarStore.create({ + cars: [ + { + id: "47", + }, + ], + selectedCar: "47", +}); + +return storeInstance.selectedCar.id; // throws + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Refine a reference and fail", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/refine-a-reference-and-fail-node-bundle.js b/build/refine-a-reference-and-fail-node-bundle.js new file mode 100644 index 0000000..f3f37bb --- /dev/null +++ b/build/refine-a-reference-and-fail-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see refine-a-reference-and-fail-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Xe(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Je(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(X(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Xt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Jt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Jt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Xt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Xn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Jn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Ci?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Ci&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Xt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Jn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Jn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Jn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Ca=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Va={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Vi(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Refine a reference and fail",(()=>{void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;const e=Va.model("Car",{id:Va.refinement(Va.identifier,(e=>0===e.indexOf("Car_")))});return Va.model("CarStore",{cars:Va.array(e),selectedCar:Va.reference(e)}).create({cars:[{id:"47"}],selectedCar:"47"}).selectedCar.id})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/refine-a-reference-and-fail-node-bundle.js.LICENSE.txt b/build/refine-a-reference-and-fail-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/refine-a-reference-and-fail-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/refine-a-reference-and-fail-web-bundle.js b/build/refine-a-reference-and-fail-web-bundle.js new file mode 100644 index 0000000..d625eca --- /dev/null +++ b/build/refine-a-reference-and-fail-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see refine-a-reference-and-fail-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw si("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw si(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw si("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw si("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw si("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw si(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw si("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw si("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw si("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw si("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw si("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw si(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw si(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw si("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw si("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw si("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw si("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw si("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw si("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function so(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw si("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||co)}var co=[void 0],fo=so(eo,void 0),po=so(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw si("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw si("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw si("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw si("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw si("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw si("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):so(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Refine a reference and fail",(()=>{void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;const e=No.model("Car",{id:No.refinement(No.identifier,(e=>0===e.indexOf("Car_")))});return No.model("CarStore",{cars:No.array(e),selectedCar:No.reference(e)}).create({cars:[{id:"47"}],selectedCar:"47"}).selectedCar.id})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/refine-a-reference-and-fail-web-bundle.js.LICENSE.txt b/build/refine-a-reference-and-fail-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/refine-a-reference-and-fail-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/refine-a-reference-and-succeed-bundle-source.js b/build/refine-a-reference-and-succeed-bundle-source.js new file mode 100644 index 0000000..4d14ce7 --- /dev/null +++ b/build/refine-a-reference-and-succeed-bundle-source.js @@ -0,0 +1,107 @@ + +import { types } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Refine a reference and succeed", () => { + const startMemory = getStartMemory(); + const Car = types.model("Car", { + id: types.refinement( + types.identifier, + (identifier) => identifier.indexOf("Car_") === 0 + ), +}); + +const CarStore = types.model("CarStore", { + cars: types.array(Car), + selectedCar: types.reference(Car), +}); + +// create a store with a normalized snapshot +const storeInstance = CarStore.create({ + cars: [ + { + id: "Car_47", + }, + ], + selectedCar: "Car_47", +}); + +return storeInstance.selectedCar.id; // "Car_47" + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Refine a reference and succeed", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/refine-a-reference-and-succeed-node-bundle.js b/build/refine-a-reference-and-succeed-node-bundle.js new file mode 100644 index 0000000..b420b1e --- /dev/null +++ b/build/refine-a-reference-and-succeed-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see refine-a-reference-and-succeed-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Xe(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Je(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(X(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=Dt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function Dt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var kt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||mt(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Cr(e)||Dr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Xt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):Dr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Jt(e,t,n){if(2!==arguments.length||Dr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):Dr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Jt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function _r(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function mr(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",_r),yr("filter",_r),yr("find",_r),yr("findIndex",_r),yr("flatMap",_r),yr("forEach",_r),yr("map",_r),yr("some",_r),yr("reduce",mr),yr("reduceRight",mr);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){_(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(_(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){t.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||Dr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=Dt(n),y=!0,g=!1,_=n.compareStructural?W.structural:n.equals||W.default,m=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!_(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,m),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||m.schedule_(),m.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return Dn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Xt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):Dr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Xn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Jn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Ci?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Dn(e)?this._subtype:Zn(e)?mn(e,!1):this.preProcessSnapshotSafe(e);return t!==Ci&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function Di(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!Di(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var ki=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(mn(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(Di(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new ki(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Xt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");kn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return kn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Jn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new _a("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),_a=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),ma=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){_n(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Dn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):_n(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Jn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(ma),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Jn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(ma);function Pa(e,t){kn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Ca=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Va={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return kn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:Dn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return kn(),new Vi(e,t,r)}};const xa=require("benchmark");var Da=new(e.n(xa)().Suite);const ka={};Da.on("complete",(function(){const e=Da.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:ka[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Da.add("Refine a reference and succeed",(()=>{void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;const e=Va.model("Car",{id:Va.refinement(Va.identifier,(e=>0===e.indexOf("Car_")))});return Va.model("CarStore",{cars:Va.array(e),selectedCar:Va.reference(e)}).create({cars:[{id:"Car_47"}],selectedCar:"Car_47"}).selectedCar.id})),Da.on("cycle",(function(e){console.log(String(e.target))})),Da.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/refine-a-reference-and-succeed-node-bundle.js.LICENSE.txt b/build/refine-a-reference-and-succeed-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/refine-a-reference-and-succeed-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/refine-a-reference-and-succeed-web-bundle.js b/build/refine-a-reference-and-succeed-web-bundle.js new file mode 100644 index 0000000..60c8088 --- /dev/null +++ b/build/refine-a-reference-and-succeed-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see refine-a-reference-and-succeed-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw si("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw si(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw si("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw si("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw si("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw si(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw si("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw si("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw si("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw si("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw si("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw si(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw si(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw si("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw si("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw si("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw si("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw si("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw si("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function so(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw si("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||co)}var co=[void 0],fo=so(eo,void 0),po=so(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw si("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw si("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw si("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw si("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw si("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw si("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):so(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Refine a reference and succeed",(()=>{void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;const e=No.model("Car",{id:No.refinement(No.identifier,(e=>0===e.indexOf("Car_")))});return No.model("CarStore",{cars:No.array(e),selectedCar:No.reference(e)}).create({cars:[{id:"Car_47"}],selectedCar:"Car_47"}).selectedCar.id})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/refine-a-reference-and-succeed-web-bundle.js.LICENSE.txt b/build/refine-a-reference-and-succeed-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/refine-a-reference-and-succeed-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/try-a-reference-and-fail-bundle-source.js b/build/try-a-reference-and-fail-bundle-source.js new file mode 100644 index 0000000..27c1a0e --- /dev/null +++ b/build/try-a-reference-and-fail-bundle-source.js @@ -0,0 +1,111 @@ + +import { types, tryReference, applySnapshot } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Try a reference and fail", () => { + const startMemory = getStartMemory(); + const Car = types.model("Car", { + id: types.identifier, +}); + +const CarStore = types.model("CarStore", { + cars: types.array(Car), + selectedCar: types.maybe(types.reference(Car)), +}); + +// create a store with a normalized snapshot +const store = CarStore.create({ + cars: [ + { + id: "47", + }, + ], + selectedCar: "47", +}); + +applySnapshot(store, { + ...store, + selectedCar: "48", +}); + +const isValid = tryReference(() => store.selectedCar); + +return isValid; + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Try a reference and fail", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/try-a-reference-and-fail-node-bundle.js b/build/try-a-reference-and-fail-node-bundle.js new file mode 100644 index 0000000..274fc1f --- /dev/null +++ b/build/try-a-reference-and-fail-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see try-a-reference-and-fail-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Xe(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Je(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(X(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=kt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function kt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var Dt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Cr(e)||kr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Xt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):kr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Jt(e,t,n){if(2!==arguments.length||kr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):kr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Jt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||kr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=kt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return kn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Xt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):kr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Xn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Jn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Ci?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=kn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Ci&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function ki(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!ki(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var Di=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(ki(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Xt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return Dn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Jn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;kn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Jn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Jn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){Dn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Ca=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Va={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:kn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return Dn(),new Vi(e,t,r)}};const xa=require("benchmark");var ka=new(e.n(xa)().Suite);const Da={};ka.on("complete",(function(){const e=ka.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Da[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),ka.add("Try a reference and fail",(()=>{void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;const e=Va.model("Car",{id:Va.identifier}),t=Va.model("CarStore",{cars:Va.array(e),selectedCar:Va.maybe(Va.reference(e))}).create({cars:[{id:"47"}],selectedCar:"47"});var r,n;return r=t,n={...t,selectedCar:"48"},Qn(),ei(r).applySnapshot(n),function(e,r){void 0===r&&(r=!0);try{var n=t.selectedCar;if(null==n)return;if(Zn(n))return r?function(e){return Qn(),ei(e).observableIsAlive}(n)?n:void 0:n;throw li("The reference to be checked is not one of node, null or undefined")}catch(e){if(e instanceof ma)return;throw e}}()})),ka.on("cycle",(function(e){console.log(String(e.target))})),ka.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/try-a-reference-and-fail-node-bundle.js.LICENSE.txt b/build/try-a-reference-and-fail-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/try-a-reference-and-fail-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/try-a-reference-and-fail-web-bundle.js b/build/try-a-reference-and-fail-web-bundle.js new file mode 100644 index 0000000..00c0494 --- /dev/null +++ b/build/try-a-reference-and-fail-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see try-a-reference-and-fail-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw si("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw si(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw si("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw si("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw si("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw si(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw si("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw si("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw si("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw si("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw si("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw si(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw si(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw si("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw si("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw si("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw si("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw si("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw si("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function so(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw si("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||co)}var co=[void 0],fo=so(eo,void 0),po=so(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw si("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw si("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw si("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw si("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw si("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw si("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):so(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Try a reference and fail",(()=>{void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;const e=No.model("Car",{id:No.identifier}),t=No.model("CarStore",{cars:No.array(e),selectedCar:No.maybe(No.reference(e))}).create({cars:[{id:"47"}],selectedCar:"47"});var n,r;return n=t,r={...t,selectedCar:"48"},Qr(),ei(n).applySnapshot(r),function(e,n){void 0===n&&(n=!0);try{var r=t.selectedCar;if(null==r)return;if(Jr(r))return n?function(e){return Qr(),ei(e).observableIsAlive}(r)?r:void 0:r;throw si("The reference to be checked is not one of node, null or undefined")}catch(e){if(e instanceof mo)return;throw e}}()})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/try-a-reference-and-fail-web-bundle.js.LICENSE.txt b/build/try-a-reference-and-fail-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/try-a-reference-and-fail-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/build/try-a-reference-and-succeed-bundle-source.js b/build/try-a-reference-and-succeed-bundle-source.js new file mode 100644 index 0000000..ecf9677 --- /dev/null +++ b/build/try-a-reference-and-succeed-bundle-source.js @@ -0,0 +1,106 @@ + +import { types, tryReference } from "mobx-state-tree"; +import Benchmark from "benchmark"; // This is technically a no-op in the web bundle, but included for cross-compatibility + +var suite = new Benchmark.Suite(); + +/** + * getStartMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getStartMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * getEndMemory is an isomorphic way to get the memory used, in bytes, + * either from the browser or from Node. + */ +const getEndMemory = () => { + if (typeof performance.memory !== "undefined") { + return performance.memory.usedJSHeapSize; + } else { + const used = process.memoryUsage(); + return used.heapUsed; + } +}; + +/** + * trackMaxMemory maintains a map of memory usage for each scenario. + * + * It uses keys that correspond to the title of each scenario, and the + * value is the maximum memory used for that scenario. + */ +const memoryUsage = {}; +const trackMaxMemory = (title, memoryUsed) => { + if (!memoryUsage[title]) { + memoryUsage[title] = memoryUsed; + } else { + memoryUsage[title] = Math.max(memoryUsage[title], memoryUsed); + } +}; + +suite.on("complete", function () { + const headers = [ + "scenario", + "ops_per_sec", + "margin_of_error", + "runs", + "max_memory_used_kb", + ]; + const results = suite.filter("successful").map((benchmark) => { + return { + scenario: benchmark.name, + opsSec: benchmark.hz, + plusMinus: benchmark.stats.rme, + runs: benchmark.stats.sample.length, + maxMemory: memoryUsage[benchmark.name], + }; + }); + + console.log(headers.join(",")); + results.forEach((result) => { + console.log(result.scenario + "," + result.opsSec + "," + result.plusMinus + "," + result.runs + "," + result.maxMemory); + }); +}); + +suite.add("Try a reference and succeed", () => { + const startMemory = getStartMemory(); + const Car = types.model("Car", { + id: types.identifier, +}); + +const CarStore = types.model("CarStore", { + cars: types.array(Car), + selectedCar: types.maybe(types.reference(Car)), +}); + +// create a store with a normalized snapshot +const store = CarStore.create({ + cars: [ + { + id: "47", + }, + ], + selectedCar: "47", +}); + +const isValid = tryReference(() => store.selectedCar); + +return isValid; + + const endMemory = getEndMemory(); + const memoryUsed = endMemory - startMemory; + trackMaxMemory("Try a reference and succeed", memoryUsed); +}); + +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + +suite.run(); diff --git a/build/try-a-reference-and-succeed-node-bundle.js b/build/try-a-reference-and-succeed-node-bundle.js new file mode 100644 index 0000000..0e192c8 --- /dev/null +++ b/build/try-a-reference-and-succeed-node-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see try-a-reference-and-succeed-node-bundle.js.LICENSE.txt */ +(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;ne.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function U(e){return Object.assign((function(t,r){B(t,r,e)}),e)}function B(e,t,r){I(e,z)||w(e,z,x({},e[z])),function(e){return e.annotationType_===$}(r)||(e[z][t]=r)}var F=Symbol("mobx administration"),H=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ge.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return bt(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionn&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var s=t[a];0===s.diffValue_&<(s,e),s.diffValue_=0}for(;i--;){var l=r[i];1===l.diffValue_&&(l.diffValue_=0,st(l,e))}n!==Ge.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}(e),nt(n),i}function Ze(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)lt(t[r],e);e.dependenciesState_=Ge.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function rt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function nt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==Ge.UP_TO_DATE_){e.dependenciesState_=Ge.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ge.UP_TO_DATE_}}var at=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},ot=!0,ut=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ot=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==(new at).version&&(ot=!1),ot?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new at):(setTimeout((function(){r(35)}),1),new at)}();function st(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function lt(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function ht(e){e.lowestObserverState_!==Ge.STALE_&&(e.lowestObserverState_=Ge.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===Ge.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=Ge.STALE_})))}var dt=function(){function e(e,t,r,n){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ge.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=Ke.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=r,this.requiresObservable_=n}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Xe(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var r=Je(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Ze(this),$e(r)&&this.reportExceptionInDerivation_(r.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var r="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(r,e),ut.globalReactionErrorHandlers.forEach((function(r){return r(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Ze(this),pt()))},t.getDisposer_=function(e){var t=this,r=function r(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",r)};return null==e||null==e.addEventListener||e.addEventListener("abort",r),r[F]=this,r},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(mt)}function mt(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n",t,e):v(r)?Re(t,r,e):y(r)?B(t,r,e?St:Pt):y(t)?U(X(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Tt=Et(!1);Object.assign(Tt,Pt);var It=Et(!0);function Nt(e){return Le(e.name,!1,e,this,void 0)}function Ct(e){return v(e)&&!0===e.isMobxAction}function Vt(e,t){var r,n,i,a,o;void 0===t&&(t=c);var u,s=null!=(r=null==(n=t)?void 0:n.name)?r:"Autorun";if(t.scheduler||t.delay){var l=kt(t),f=!1;u=new dt(s,(function(){f||(f=!0,l((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(s,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(a=i.signal)&&a.aborted||u.schedule_(),u.getDisposer_(null==(o=t)?void 0:o.signal)}Object.assign(It,St),Tt.bound=U(jt),It.bound=U(At);var xt=function(e){return e()};function kt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xt}var Dt="onBO",Rt="onBUO";function Lt(e,t,r){return Mt(Rt,e,t,r)}function Mt(e,t,r,n){var i="function"==typeof n?en(t,r):en(t),a=v(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),0===e.size&&delete i[o])}}var zt=0;function Ut(){this.message="FLOW_CANCELLED"}Ut.prototype=Object.create(Error.prototype);var Bt=ee("flow"),Ft=ee("flow.bound",{bound:!0}),Ht=Object.assign((function(e,t){if(y(t))return B(e,t,Bt);var r=e,n=r.name||"",i=function(){var e,t=arguments,i=++zt,a=Tt(n+" - runid: "+i+" - init",r).apply(this,t),o=void 0,u=new Promise((function(t,r){var u=0;function s(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.next).call(a,e)}catch(e){return r(e)}c(t)}function l(e){var t;o=void 0;try{t=Tt(n+" - runid: "+i+" - yield "+u++,a.throw).call(a,e)}catch(e){return r(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(o=Promise.resolve(e.value)).then(s,l);e.then(c,r)}e=r,s(void 0)}));return u.cancel=Tt(n+" - runid: "+i+" - cancel",(function(){try{o&&Gt(o);var t=a.return(void 0),r=Promise.resolve(t.value);r.then(d,d),Gt(r),e(new Ut)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Bt);function Gt(e){v(e.cancel)&&e.cancel()}function Kt(e){return!0===(null==e?void 0:e.isMobXFlow)}function Wt(e,t,r){var n;return Cr(e)||jr(e)||He(e)?n=tn(e):Br(e)&&(n=tn(e,t)),n.dehancer="function"==typeof t?t:r,function(){n.dehancer=void 0}}function qt(e,t,r){return v(r)?function(e,t,r){return tn(e,t).intercept_(r)}(e,t,r):function(e,t){return tn(e).intercept_(t)}(e,t)}function Yt(e){return function(e,t){return!!e&&(void 0!==t?!!Br(e)&&e[F].values_.has(t):Br(e)||!!e[F]||G(e)||_t(e)||qe(e))}(e)}function $t(e){return Br(e)?e[F].keys_():Cr(e)||kr(e)?Array.from(e.keys()):jr(e)?e.map((function(e,t){return t})):void r(5)}function Xt(e){return Br(e)?$t(e).map((function(t){return e[t]})):Cr(e)?$t(e).map((function(t){return e.get(t)})):kr(e)?Array.from(e.values()):jr(e)?e.slice():void r(6)}function Jt(e,t,n){if(2!==arguments.length||kr(e))Br(e)?e[F].set_(t,n):Cr(e)?e.set(t,n):kr(e)?e.add(t):jr(e)?("number"!=typeof t&&(t=parseInt(t,10)),t<0&&r("Invalid index: '"+t+"'"),ft(),t>=e.length&&(e.length=t+1),e[t]=n,pt()):r(8);else{ft();var i=t;try{for(var a in i)Jt(e,a,i[a])}finally{pt()}}}function Zt(e,t,n){if(Br(e))return e[F].defineProperty_(t,n);r(39)}function Qt(e,t,r,n){return v(r)?function(e,t,r,n){return tn(e,t).observe_(r,n)}(e,t,r,n):function(e,t,r){return tn(e).observe_(t,r)}(e,t,r)}function er(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tr(e,t,r){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var r,n,i;if(null!=t&&null!=(r=t.signal)&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var a=new Promise((function(r,a){var o,u=rr(e,r,x({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},null==t||null==(o=t.signal)||null==o.addEventListener||o.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return a.cancel=n,a}(e,t):rr(e,t,r||{})}function rr(e,t,r){var n;if("number"==typeof r.timeout){var i=new Error("WHEN_TIMEOUT");n=setTimeout((function(){if(!o[F].isDisposed_){if(o(),!r.onError)throw i;r.onError(i)}}),r.timeout)}r.name="When";var a=Re("When-effect",t),o=Vt((function(t){Me(!1,e)&&(t.dispose(),n&&clearTimeout(n),a())}),r);return o}function nr(e){return e[F]}Ht.bound=U(Ft);var ir={has:function(e,t){return nr(e).has_(t)},get:function(e,t){return nr(e).get_(t)},set:function(e,t,r){var n;return!!y(t)&&(null==(n=nr(e).set_(t,r,!0))||n)},deleteProperty:function(e,t){var r;return!!y(t)&&(null==(r=nr(e).delete_(t,!0))||r)},defineProperty:function(e,t,r){var n;return null==(n=nr(e).defineProperty_(t,r))||n},ownKeys:function(e){return nr(e).ownKeys_()},preventExtensions:function(e){r(13)}};function ar(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function or(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function ur(e,t){var n=et();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a0}function lr(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),h((function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}))}function cr(e,t){var r=et(),n=e.changeListeners_;if(n){for(var i=0,a=(n=n.slice()).length;i0?e.map(this.dehancer):e},t.intercept_=function(e){return or(this,e)},t.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),lr(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){("number"!=typeof e||isNaN(e)||e<0)&&r("Out of range: "+e);var t=this.values_.length;if(e!==t)if(e>t){for(var n=new Array(e-t),i=0;i0&&Zr(e+t+1)},t.spliceWithArray_=function(e,t,r){var n=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===r&&(r=l),ar(this)){var a=ur(this,{object:this.proxy_,type:fr,index:e,removedCount:t,added:r});if(!a)return l;t=a.removedCount,r=a.added}if(r=0===r.length?r:r.map((function(e){return n.enhancer_(e,void 0)})),this.legacyMode_){var o=r.length-t;this.updateArrayLength_(i,o)}var u=this.spliceItemsIntoValues_(e,t,r);return 0===t&&0===r.length||this.notifyArraySplice_(e,r,u),this.dehanceValues_(u)},t.spliceItemsIntoValues_=function(e,t,r){var n;if(r.length<1e4)return(n=this.values_).splice.apply(n,[e,t].concat(r));var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=r.length-t;for(var o=0;o=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},t.set_=function(e,t){var n=this.values_;if(this.legacyMode_&&e>n.length&&r(17,e,n.length),e2?r-2:0),i=2;i-1&&(this.splice(r,1),!0)}};function yr(e,t){"function"==typeof Array.prototype[e]&&(vr[e]=t(e))}function gr(e){return function(){var t=this[F];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function mr(e){return function(t,r){var n=this,i=this[F];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(r,e,i,n)}))}}function _r(e){return function(){var t=this,r=this[F];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(e,r,n){return i(e,r,n,t)},n[e].apply(n,arguments)}}yr("concat",gr),yr("flat",gr),yr("includes",gr),yr("indexOf",gr),yr("join",gr),yr("lastIndexOf",gr),yr("slice",gr),yr("toString",gr),yr("toLocaleString",gr),yr("every",mr),yr("filter",mr),yr("find",mr),yr("findIndex",mr),yr("flatMap",mr),yr("forEach",mr),yr("map",mr),yr("some",mr),yr("reduce",_r),yr("reduceRight",_r);var wr,Or,Pr=P("ObservableArrayAdministration",hr);function jr(e){return g(e)&&Pr(e[F])}var Sr={},Ar="add",Er="delete";wr=Symbol.iterator,Or=Symbol.toStringTag;var Tr,Ir,Nr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[F]=Sr,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,v(Map)||r(18),nn((function(){i.keysAtom_=K("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)}))}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var r=this.hasMap_.get(e);if(!r){var n=r=new Fe(this.has_(e),Y,"ObservableMap.key?",!1);this.hasMap_.set(e,n),Lt(n,(function(){return t.hasMap_.delete(e)}))}return r.get()},t.set=function(e,t){var r=this.has_(e);if(ar(this)){var n=ur(this,{type:r?pr:Ar,object:this,newValue:t,name:e});if(!n)return this;t=n.newValue}return r?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(this.keysAtom_,ar(this)&&!ur(this,{type:Er,object:this,name:e}))return!1;if(this.has_(e)){var r=sr(this),n=r?{observableKind:"map",debugObjectName:this.name_,type:Er,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return er((function(){var r;t.keysAtom_.reportChanged(),null==(r=t.hasMap_.get(e))||r.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.updateValue_=function(e,t){var r=this.data_.get(e);if((t=r.prepareNewValue_(t))!==ut.UNCHANGED){var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:pr,object:this,oldValue:r.value_,name:e,newValue:t}:null;r.setNewValue_(t),n&&cr(this,i)}},t.addValue_=function(e,t){var r=this;this.keysAtom_,er((function(){var n,i=new Fe(t,r.enhancer_,"ObservableMap.key",!1);r.data_.set(e,i),t=i.value_,null==(n=r.hasMap_.get(e))||n.setNewValue_(!0),r.keysAtom_.reportChanged()}));var n=sr(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,name:e,newValue:t}:null;n&&cr(this,i)},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return ln({next:function(){var r=t.next(),n=r.done,i=r.value;return{done:n,value:n?void 0:[i,e.get(i)]}}})},t[wr]=function(){return this.entries()},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Cr(e)&&(e=new Map(e)),er((function(){m(e)?function(e){var t=Object.keys(e);if(!A)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter((function(t){return s.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(r){return t.set(r,e[r])})):Array.isArray(e)?e.forEach((function(e){var r=e[0],n=e[1];return t.set(r,n)})):j(e)?(e.constructor!==Map&&r(19,e),e.forEach((function(e,r){return t.set(r,e)}))):null!=e&&r(20,e)})),this},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.keys());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.replace=function(e){var t=this;return er((function(){for(var n,i=function(e){if(j(e)||Cr(e))return e;if(Array.isArray(e))return new Map(e);if(m(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}return r(21,e)}(e),a=new Map,o=!1,u=M(t.data_.keys());!(n=u()).done;){var s=n.value;if(!i.has(s))if(t.delete(s))o=!0;else{var l=t.data_.get(s);a.set(s,l)}}for(var c,f=M(i.entries());!(c=f()).done;){var p=c.value,b=p[0],h=p[1],d=t.data_.has(b);if(t.set(b,h),t.data_.has(b)){var v=t.data_.get(b);a.set(b,v),d||(o=!0)}}if(!o)if(t.data_.size!==a.size)t.keysAtom_.reportChanged();else for(var y=t.data_.keys(),g=a.keys(),_=y.next(),w=g.next();!_.done;){if(_.value!==w.value){t.keysAtom_.reportChanged();break}_=y.next(),w=g.next()}t.data_=a})),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return lr(this,e)},t.intercept_=function(e){return or(this,e)},V(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Or,get:function(){return"Map"}}]),e}(),Cr=P("ObservableMap",Nr),Vr={};Tr=Symbol.iterator,Ir=Symbol.toStringTag;var xr=function(){function e(e,t,n){var i=this;void 0===t&&(t=q),void 0===n&&(n="ObservableSet"),this.name_=void 0,this[F]=Vr,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,v(Set)||r(22),this.enhancer_=function(e,r){return t(e,r,n)},nn((function(){i.atom_=K(i.name_),e&&i.replace(e)}))}var t=e.prototype;return t.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},t.clear=function(){var e=this;er((function(){Qe((function(){for(var t,r=M(e.data_.values());!(t=r()).done;){var n=t.value;e.delete(n)}}))}))},t.forEach=function(e,t){for(var r,n=M(this);!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(this.atom_,ar(this)&&!ur(this,{type:Ar,object:this,newValue:e}))return this;if(!this.has(e)){er((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Ar,object:this,newValue:e}:null;r&&cr(this,n)}return this},t.delete=function(e){var t=this;if(ar(this)&&!ur(this,{type:Er,object:this,oldValue:e}))return!1;if(this.has(e)){var r=sr(this),n=r?{observableKind:"set",debugObjectName:this.name_,type:Er,object:this,oldValue:e}:null;return er((function(){t.atom_.reportChanged(),t.data_.delete(e)})),r&&cr(this,n),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=0,t=Array.from(this.keys()),r=Array.from(this.values());return ln({next:function(){var n=e;return e+=1,nqr){for(var t=qr;t=0&&r++}e=sn(e),t=sn(t);var u="[object Array]"===o;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var s=e.constructor,l=t.constructor;if(s!==l&&!(v(s)&&s instanceof s&&v(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(0===r)return!1;r<0&&(r=-1),i=i||[];for(var c=(n=n||[]).length;c--;)if(n[c]===e)return i[c]===t;if(n.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!un(e[c],t[c],r-1,n,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!I(t,f=p[c])||!un(e[f],t[f],r-1,n,i))return!1}return n.pop(),i.pop(),!0}function sn(e){return jr(e)?e.slice():j(e)||Cr(e)||S(e)||kr(e)?Array.from(e.entries()):e}function ln(e){return e[Symbol.iterator]=cn,e}function cn(){return this}["Symbol","Map","Set"].forEach((function(e){void 0===i()[e]&&r("MobX requires global '"+e+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rn},$mobx:F});var fn;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fn||(fn={}));var pn=function(e,t){return pn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},pn(e,t)};function bn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}pn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hn=function(){return hn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function yn(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(On);Pn.prototype.die=Tt(Pn.prototype.die);var jn,Sn,An=1,En={onError:function(e){throw e}},Tn=function(e){function t(t,r,n,i,a){var o=e.call(this,t,r,n,i)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++An}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Ne((function(){return o.getSnapshot()})),o.unbox=o.unbox.bind(o),o._initialSnapshot=a,o.identifierAttribute=t.identifierAttribute,r||(o.identifierCache=new $n),o._childNodes=t.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var u=o._initialSnapshot[o.identifierAttribute];if(void 0===u){var s=o._childNodes[o.identifierAttribute];s&&(u=s.value)}if("string"!=typeof u&&"number"!=typeof u)throw li("Instance identifier '"+o.identifierAttribute+"' for type '"+o.type.name+"' must be a string or a number");o.identifier=Ia(u),o.unnormalizedIdentifier=u}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return bn(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var a=[],o=this.parent;o&&0===o._observableInstanceState;)a.unshift(o),o=o.parent;try{for(var u=dn(a),s=u.next();!s.done;s=u.next())(p=s.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}var l=this.type;try{this.storedValue=l.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,l.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=qn.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=qn.CREATED,e){this.fireHook(fn.afterCreate),this.finalizeCreation();try{for(var c=dn(a.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fn.afterCreate),p.finalizeCreation()}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fn.beforeDetach);var e=this.state;this.state=qn.DETACHING;var t=this.root,r=t.environment,n=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=r,this.identifierCache=n}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e!==this.parent,n=t!==this.subpath;(r||n)&&(r?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fn.afterAttach)):n&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var r=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof r&&(Nt?Nt((function(){r.apply(t.storedValue)})):r.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,r=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,r),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r="warn";if(!this.isAlive){var n=this._getAssertAliveError(e);switch(r){case"error":throw li(n);case"warn":t=n,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",r=e.subpath&&Ei(e.subpath)||"",n=e.actionContext||Rn;n&&"action"!==n.type&&n.parentActionEvent&&(n=n.parentActionEvent);var i,a="";return n&&null!=n.name&&(a=(n&&n.context&&(Qn(i=n.context,1),ei(i).path)||t)+"."+n.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+r+"', Action: '"+a+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw li("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,r;try{for(var n=dn(e.getChildren()),i=n.next();!i.done;i=n.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e.fireInternalHook(fn.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw li("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Mn(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var r=function(e){var t=e.split("/").map(Ti);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw li("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ni(e,r.slice(0,-1)).applyPatchLocally(r[r.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Mn(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ri)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==qn.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var r=function(e){for(var t=[],r=1;r=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;void 0===t&&(t=!0);var n={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(n):this.middlewares=[n],function(){r.removeMiddleware(n)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,r,n){var i,a,o,u;void 0===n&&(n=c);var s,l,f,p,b=null!=(i=n.name)?i:"Reaction",h=Tt(b,n.onError?(s=n.onError,l=r,function(){try{return l.apply(this,arguments)}catch(e){s.call(this,e)}}):r),d=!n.scheduler&&!n.delay,v=kt(n),y=!0,g=!1,m=n.compareStructural?W.structural:n.equals||W.default,_=new dt(b,(function(){y||d?w():g||(g=!0,v(w))}),n.onError,n.requiresObservable);function w(){if(g=!1,!_.isDisposed_){var t=!1;_.track((function(){var r=Me(!1,(function(){return e.snapshot}));t=y||!m(f,r),p=f,f=r})),(y&&n.fireImmediately||!y&&t)&&h(f,p,_),y=!1}}return null!=(a=n)&&null!=(o=a.signal)&&o.aborted||_.schedule_(),_.getDisposer_(null==(u=n)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),En);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this._internalEvents||(this._internalEvents=new _i),this._internalEvents.register(e,t,r)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n0},enumerable:!1,configurable:!0})}();var Rn,Ln=1;function Mn(e,t,r){var n=function(){var n=Ln++,i=Rn,a=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var r=ei(e.context);"action"===e.type&&r.assertAlive({actionContext:e});var n=r._isRunningAction;r._isRunningAction=!0;var i=Rn;Rn=e;try{return function(e,t,r){var n=new zn(e,r);if(n.isEmpty)return Tt(r).apply(null,t.args);var i=null;return function e(t){var a=n.getNextMiddleware(),o=a&&a.handler;return o?!a.includeHooks&&fn[t.name]?e(t):(o(t,(function(t,r){i=e(t),r&&(i=r(i))}),(function(e){i=e})),i):Tt(r).apply(null,t.args)}(t)}(r,e,t)}finally{Rn=i,r._isRunningAction=n}}({type:"action",name:t,id:n,args:wi(arguments),context:e,tree:wn(e),rootId:i?i.rootId:n,parentId:i?i.id:0,allParentIds:i?yn(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:a},r)};return n._isMSTAction=!0,n._isFlowAction=r._isFlowAction,n}var zn=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var r=e;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Un(e){return"function"==typeof e?"":Zn(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Bn(e){var t=e.value,r=e.context[e.context.length-1].type,n=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=n.length>0?'at path "/'+n+'" ':"",a=Zn(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",o=r&&Zn(t)&&r.is(ei(t).snapshot);return""+i+a+" "+Un(t)+" is not assignable "+(r?"to type: `"+r.name+"`":"")+(e.message?" ("+e.message+")":"")+(r?function(e){return kn(e)&&(e.flags&(Sn.String|Sn.Number|Sn.Integer|Sn.Boolean|Sn.Date))>0}(r)||vi(t)?".":", expected an instance of `"+r.name+"` or a snapshot like `"+r.describe()+"` instead."+(o?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Fn(e,t,r){return e.concat([{path:t,type:r}])}function Hn(){return oi}function Gn(e,t,r){return[{context:e,value:t,message:r}]}function Kn(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Wn(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var r=e.validate(t,[{path:"",type:e}]);if(r.length>0)throw li(function(e,t,r){var n;if(0!==r.length)return"Error while converting "+(((n=Un(t)).length<280?n:n.substring(0,272)+"......"+n.substring(n.length-8))+" to `")+e.name+"`:\n\n "+r.map(Bn).join("\n ")}(e,t,r))}(e,t)}var qn,Yn=0,$n=function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:Yn++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var r=e.identifier;this.cache.has(r)||this.cache.set(r,Ae.array([],si));var n=this.cache.get(r);if(-1!==n.indexOf(e))throw li("Already registered");n.push(e),t&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Xt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,r=this.cache.get(t);r&&(r.remove(e),r.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n,i=this,a=new e,o=t.path+"/";return(n=this.cache,Br(n)?$t(n).map((function(e){return[e,n[e]]})):Cr(n)?$t(n).map((function(e){return[e,n.get(e)]})):kr(n)?Array.from(n.entries()):jr(n)?n.map((function(e,t){return[t,e]})):void r(7)).forEach((function(e){for(var r=vn(e,2),n=r[0],u=r[1],s=!1,l=u.length-1;l>=0;l--){var c=u[l];c!==t&&0!==c.path.indexOf(o)||(a.addNodeToCache(c,!1),u.splice(l,1),u.length||i.cache.delete(n),s=!0)}s&&i.updateLastCacheModificationPerId(n)})),a}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);return!!r&&r.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.cache.get(t);if(!r)return null;var n=r.filter((function(t){return e.isAssignableFrom(t.type)}));switch(n.length){case 0:return null;case 1:return n[0];default:throw li("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+n.map((function(e){return e.path})).join(", "))}}}),e}();function Xn(e,t,r,n,i){var a=ti(i);if(a){if(a.parent)throw li("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+r+"', but it lives already at '"+a.path+"'");return t&&a.setParent(t,r),a}return new Tn(e,t,r,n,i)}function Jn(e,t,r,n,i){return new Pn(e,t,r,n,i)}function Zn(e){return!(!e||!e.$treenode)}function Qn(e,t){Pi()}function ei(e){if(!Zn(e))throw li("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ri(){return ei(this).snapshot}function ni(e,t,r){void 0===r&&(r=!0);var n=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){r.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?n:this.preProcessSnapshot(n),a=this._subtype.instantiate(e,t,r,i);return this._fixNode(a),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._subtype.reconcile(e,Zn(t)?t:this.preProcessSnapshot(t),r,n);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var r=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(r):r}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.preProcessSnapshotSafe(e);return r===Ci?Gn(t,e,"Failed to preprocess value"):this._subtype.validate(r,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=kn(e)?this._subtype:Zn(e)?_n(e,!1):this.preProcessSnapshotSafe(e);return t!==Ci&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof Vn))return!1;var r=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,r)}}),t}(Cn),xi="Map.put can only be used to store complex values that have an identifier type attribute";function ki(e,t){var r,n,i=e.getSubTypes();if(i===In)return!1;if(i){var a=bi(i);try{for(var o=dn(a),u=o.next();!u.done;u=o.next())if(!ki(u.value,t))return!1}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}return e instanceof Ki&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ni||(Ni={}));var Di=function(e){function t(t,r){return e.call(this,t,Ae.ref.enhancer,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.prototype.set.call(this,""+t,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw li("Map.put cannot be used to set empty values");if(Zn(e)){var t=ei(e);if(null===t.identifier)throw li(xi);return this.set(t.identifier,e),e}if(di(e)){var r=ei(this),n=r.type;if(n.identifierMode!==Ni.YES)throw li(xi);var i=e[n.mapIdentifierAttribute];if(!Na(i)){var a=this.put(n.getChildType().create(e,r.environment));return this.put(_n(a))}var o=Ia(i);return this.set(o,e),this.get(o)}throw li("Map.put can only be used to store complex values")}}),t}(Nr),Ri=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ni.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._determineIdentifierMode(),Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ni.UNKNOWN){var e=[];if(ki(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw li("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ni.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ni.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var r=e.type._subType,n={};return Object.keys(t).forEach((function(i){n[i]=r.instantiate(e,i,void 0,t[i])})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Xt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.storedValue.get(""+t);if(!r)throw li("Not a child "+t);return r}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),r=e.name;t.assertWritable({subpath:r});var n=t.type,i=n._subType;switch(e.type){case"update":var a=e.newValue;if(a===e.object.get(r))return null;Wn(i,a),e.newValue=i.reconcile(t.getChildNode(r),e.newValue,t,r),n.processIdentifier(r,e.newValue);break;case"add":Wn(i,e.newValue),e.newValue=i.instantiate(t,r,void 0,e.newValue),n.processIdentifier(r,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ni.YES&&t instanceof Tn){var r=t.identifier;if(r!==e)throw li("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+r+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:Ei(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:Ei(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var r=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:Ei(e.name),oldValue:r},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=e.storedValue;switch(r.op){case"add":case"replace":n.set(t,r.value);break;case"remove":n.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Wn(this,t);var r=e.storedValue,n={};if(Array.from(r.keys()).forEach((function(e){n[e]=!1})),t)for(var i in t)r.set(i,t[i]),n[""+i]=!0;Object.keys(n).forEach((function(e){!1===n[e]&&r.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return hi(e)?Kn(Object.keys(e).map((function(n){return r._subType.validate(e[n],Fn(t,n,r._subType))}))):Gn(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(Vn);Ri.prototype.applySnapshot=Tt(Ri.prototype.applySnapshot);var Li=function(e){function t(t,r,n){void 0===n&&(n=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=n,i}return bn(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Xn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var r=e.type._subType,n={};return t.forEach((function(t,i){var a=""+i;n[a]=r.instantiate(e,a,void 0,t)})),n}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=hn(hn({},si),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){tn(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var r=e(t);Object.keys(r).forEach((function(e){var n=r[e],i=Mn(t,e,n);gi(t,e,i)}))})),qt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Number(t);if(r=0;r--)t.emitPatch({op:"remove",path:""+(e.index+r),oldValue:e.removed[r].snapshot},t);for(r=0;r0)return r;var n=Zn(e)?ei(e).snapshot:e;return this._predicate(n)?Hn():Gn(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn),oa=function(e){function t(t,r,n){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),n=hn({eager:!0,dispatcher:void 0},n),i._dispatcher=n.dispatcher,n.eager||(i._eager=!1),i}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sn.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(n,void 0);if(!i)throw li("No matching type for union "+this.describe());return i.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.determineType(t,e.getReconciliationType());if(!i)throw li("No matching type for union "+this.describe());return i.reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var r=[],n=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,r,i)}return this._subtype.instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),r,n)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Wn(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Hn():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Cn);function la(e,t,r){return function(e,t){if("function"!=typeof t&&Zn(t))throw li("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dn()}(0,t),new sa(e,t,r||ca)}var ca=[void 0],fa=la(ea,void 0),pa=la(Qi,null);function ba(e){return Dn(),ua(e,fa)}var ha=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n}return bn(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sn.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw li("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).instantiate(e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.getSubType(!0).reconcile(e,t,r,n)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getSubType(!1);return r?r.validate(e,t):Hn()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||In}}),t}(Cn),da=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Lazy}),Object.defineProperty(n,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tr((function(){return n.pendingNodeList.length>0&&n.pendingNodeList.some((function(e){return e.isAlive&&n.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){n.options.loadType().then(Tt((function(e){n.loadedType=e,n.pendingNodeList.forEach((function(e){e.parent&&n.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,r,n);var a=Jn(this,e,t,r,n);return this.pendingNodeList.push(a),tr((function(){return!a.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(a),1)})),a}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Hn():Gn(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return this.loadedType?(t.die(),this.loadedType.instantiate(n,i,n.environment,r)):e.prototype.reconcile.call(this,t,r,n,i)}}),t}(xn),va=function(e){function t(t){var r=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Frozen}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Hn():Gn(t,e,"Value is not serializable and cannot be frozen")}}),t}(xn),ya=new va,ga=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Na(e))this.identifier=e;else{if(!Zn(e))throw li("Can only store references to tree nodes or identifiers, got: '"+e+"'");var r=ei(e);if(!r.identifierAttribute)throw li("Can only store references with a defined identifier attribute.");var n=r.unnormalizedIdentifier;if(null==n)throw li("Can only store references to tree nodes with a defined identifier.");this.identifier=n}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ia(this.identifier),r=e.root,n=r.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==n){var i=this.targetType,a=r.identifierCache.resolve(i,t);if(!a)throw new ma("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:a,lastCacheModification:n}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),ma=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return bn(t,e),t}(Error),_a=function(e){function t(t,r){var n=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(n,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Reference}),n}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Na(e)?Hn():Gn(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=t.parent;if(i&&i.isAlive){var a=i.storedValue;a&&this.onInvalidated({cause:e,parent:a,invalidTarget:n?n.storedValue:void 0,invalidId:r,replaceRef:function(e){mn(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;kn(e=i.type)&&(e.flags&Sn.Object)>0?this.replaceRef(void 0):mn(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=this.getValue(e);if(n){var i=ei(n),a=function(n,a){var o=function(e){switch(e){case fn.beforeDestroy:return"destroy";case fn.beforeDetach:return"detach";default:return}}(a);o&&r.fireInvalidated(o,e,t,i)},o=i.registerHook(fn.beforeDetach,a),u=i.registerHook(fn.beforeDestroy,a);return function(){o(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;if(this.onInvalidated){var i;e.registerHook(fn.beforeDestroy,(function(){i&&i()}));var a=function(a){i&&i();var o=e.parent,u=o&&o.storedValue;o&&o.isAlive&&u&&((r?r.get(t,u):e.root.identifierCache.has(n.targetType,Ia(t)))?i=n.addTargetNodeWatcher(e,t):a||n.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===qn.FINALIZED?a(!0):(e.isRoot||e.root.registerHook(fn.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fn.afterAttach,(function(){a(!1)})))}}}),t}(xn),wa=function(e){function t(t,r){return e.call(this,t,r)||this}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,a=Zn(n)?(Qn(i=n),ei(i).identifier):n,o=new ga(n,this.targetType),u=Jn(this,e,t,r,o);return o.node=u,this.watchTargetNodeForInvalidations(u,a,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!e.isDetaching&&e.type===this){var i=Zn(t),a=e.storedValue;if(!i&&a.identifier===t||i&&a.resolvedValue===t)return e.setParent(r,n),e}var o=this.instantiate(r,n,void 0,t);return e.die(),o}}),t}(_a),Oa=function(e){function t(t,r,n){var i=e.call(this,t,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return bn(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(n)?this.options.set(n,e?e.storedValue:null):n,a=Jn(this,e,t,r,i);return this.watchTargetNodeForInvalidations(a,i,this.options),a}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=Zn(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(r,n),e;var a=this.instantiate(r,n,void 0,i);return e.die(),a}}),t}(_a);function Pa(e,t){Dn();var r=t||void 0,n=t?t.onInvalidated:void 0;return r&&(r.get||r.set)?new Oa(e,{get:r.get,set:r.set},n):new wa(e,n)}var ja=function(e){function t(t,r){var n=e.call(this,t)||this;return Object.defineProperty(n,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),n}return bn(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(!(e&&e.type instanceof Ki))throw li("Identifier types can only be instantiated as direct child of a model type");return Jn(this,e,t,r,n)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(e.storedValue!==t)throw li("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(r,n),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?Gn(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Hn()}}),t}(xn),Sa=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Identifier}),t}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(ja),Aa=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return bn(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(ja),Ea=new Sa,Ta=new Aa;function Ia(e){return""+e}function Na(e){return"string"==typeof e||"number"==typeof e}var Ca=function(e){function t(t){var r=e.call(this,t.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sn.Custom}),r}return bn(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Hn();var r=this.options.getValidationMessage(e);return r?Gn(t,e,"Invalid value for type '"+this.name+"': "+r):Hn()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Jn(this,e,t,r,this.options.isTargetType(n)?n:this.options.fromSnapshot(n,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(r,n),e;var a=i?this.options.fromSnapshot(t,r.root.environment):t,o=this.instantiate(r,n,void 0,a);return e.die(),o}}),t}(xn),Va={enumeration:function(e,t){var r="string"==typeof e?t:e,n=ua.apply(void 0,yn(r.map((function(e){return ia(""+e)}))));return"string"==typeof e&&(n.name=e),n},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dn(),new Li(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?ya:kn(e)?new va(e):la(ya,e)},identifier:Ea,identifierNumber:Ta,late:function(e,t){var r="string"==typeof e?e:"late("+e.toString()+")";return new ha(r,"string"==typeof e?t:e)},lazy:function(e,t){return new da(e,t)},undefined:ea,null:Qi,snapshotProcessor:function(e,t,r){return Dn(),new Vi(e,t,r)}};const xa=require("benchmark");var ka=new(e.n(xa)().Suite);const Da={};ka.on("complete",(function(){const e=ka.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Da[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),ka.add("Try a reference and succeed",(()=>{void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;const e=Va.model("Car",{id:Va.identifier}),t=Va.model("CarStore",{cars:Va.array(e),selectedCar:Va.maybe(Va.reference(e))}).create({cars:[{id:"47"}],selectedCar:"47"});return function(e,r){void 0===r&&(r=!0);try{var n=t.selectedCar;if(null==n)return;if(Zn(n))return r?(i=n,Qn(),ei(i).observableIsAlive?n:void 0):n;throw li("The reference to be checked is not one of node, null or undefined")}catch(e){if(e instanceof ma)return;throw e}var i}()})),ka.on("cycle",(function(e){console.log(String(e.target))})),ka.run(),module.exports.suite=t})(); \ No newline at end of file diff --git a/build/try-a-reference-and-succeed-node-bundle.js.LICENSE.txt b/build/try-a-reference-and-succeed-node-bundle.js.LICENSE.txt new file mode 100644 index 0000000..c18ab1d --- /dev/null +++ b/build/try-a-reference-and-succeed-node-bundle.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ diff --git a/build/try-a-reference-and-succeed-web-bundle.js b/build/try-a-reference-and-succeed-web-bundle.js new file mode 100644 index 0000000..e384e1d --- /dev/null +++ b/build/try-a-reference-and-succeed-web-bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see try-a-reference-and-succeed-web-bundle.js.LICENSE.txt */ +var suite;(()=>{var e={215:function(e,t,n){var r,i;e=n.nmd(e),function(){"use strict";var o,a={function:!0,object:!0},u=a[typeof window]&&window||this,l=(n.amdD,a[typeof t]&&t&&!t.nodeType&&t),s=a.object&&e&&!e.nodeType&&e,c=l&&s&&"object"==typeof n.g&&n.g;!c||c.global!==c&&c.window!==c&&c.self!==c||(u=c);var f=0,p=(s&&s.exports,/^(?:boolean|number|string|undefined)$/),h=0,b=["Array","Date","Function","Math","Object","RegExp","String","_","clearTimeout","chrome","chromium","document","navigator","phantom","platform","process","runtime","setTimeout"],d={1:4096,2:512,3:64,4:8,5:0},v={1:12.706,2:4.303,3:3.182,4:2.776,5:2.571,6:2.447,7:2.365,8:2.306,9:2.262,10:2.228,11:2.201,12:2.179,13:2.16,14:2.145,15:2.131,16:2.12,17:2.11,18:2.101,19:2.093,20:2.086,21:2.08,22:2.074,23:2.069,24:2.064,25:2.06,26:2.056,27:2.052,28:2.048,29:2.045,30:2.042,infinity:1.96},y={5:[0,1,2],6:[1,2,3,5],7:[1,3,5,6,8],8:[2,4,6,8,10,13],9:[2,4,7,10,12,15,17],10:[3,5,8,11,14,17,20,23],11:[3,6,9,13,16,19,23,26,30],12:[4,7,11,14,18,22,26,29,33,37],13:[4,8,12,16,20,24,28,33,37,41,45],14:[5,9,13,17,22,26,31,36,40,45,50,55],15:[5,10,14,19,24,29,34,39,44,49,54,59,64],16:[6,11,15,21,26,31,37,42,47,53,59,64,70,75],17:[6,11,17,22,28,34,39,45,51,57,63,67,75,81,87],18:[7,12,18,24,30,36,42,48,55,61,67,74,80,86,93,99],19:[7,13,19,25,32,38,45,52,58,65,72,78,85,92,99,106,113],20:[8,14,20,27,34,41,48,55,62,69,76,83,90,98,105,112,119,127],21:[8,15,22,29,36,43,50,58,65,73,80,88,96,103,111,119,126,134,142],22:[9,16,23,30,38,45,53,61,69,77,85,93,101,109,117,125,133,141,150,158],23:[9,17,24,32,40,48,56,64,73,81,89,98,106,115,123,132,140,149,157,166,175],24:[10,17,25,33,42,50,59,67,76,85,94,102,111,120,129,138,147,156,165,174,183,192],25:[10,18,27,35,44,53,62,71,80,89,98,107,117,126,135,145,154,163,173,182,192,201,211],26:[11,19,28,37,46,55,64,74,83,93,102,112,122,132,141,151,161,171,181,191,200,210,220,230],27:[11,20,29,38,48,57,67,77,87,97,107,118,125,138,147,158,168,178,188,199,209,219,230,240,250],28:[12,21,30,40,50,60,70,80,90,101,111,122,132,143,154,164,175,186,196,207,218,228,239,250,261,272],29:[13,22,32,42,52,62,73,83,94,105,116,127,138,149,160,171,182,193,204,215,226,238,249,260,271,282,294],30:[13,23,33,43,54,65,76,87,98,109,120,131,143,154,166,177,189,200,212,223,235,247,258,270,282,293,305,317]};function g(e){var t=e&&e._||J("lodash")||u._;if(!t)return F.runInContext=g,F;(e=e?t.defaults(u.Object(),e,t.pick(u,b)):u).Array;var r=e.Date,i=e.Function,a=e.Math,s=e.Object,c=(e.RegExp,e.String),_=[],m=s.prototype,w=a.abs,O=e.clearTimeout,j=a.floor,P=(a.log,a.max),S=a.min,A=a.pow,x=_.push,E=(e.setTimeout,_.shift),T=_.slice,C=a.sqrt,I=(m.toString,_.unshift),k=J,N=Y(e,"document")&&e.document,V=k("microtime"),D=Y(e,"process")&&e.process,R=N&&N.createElement("div"),M="uid"+t.now(),L={},z={};!function(){z.browser=N&&Y(e,"navigator")&&!Y(e,"phantom"),z.timeout=Y(e,"setTimeout")&&Y(e,"clearTimeout");try{z.decompilation="1"===i(("return ("+function(e){return{x:""+(1+e),y:0}}+")").replace(/__cov__[^;]+;/g,""))()(0).x}catch(e){z.decompilation=!1}}();var B={ns:r,start:null,stop:null};function F(e,n,r){var i=this;if(!(i instanceof F))return new F(e,n,r);t.isPlainObject(e)?r=e:t.isFunction(e)?(r=n,n=e):t.isPlainObject(n)?(r=n,n=null,i.name=e):i.name=e,ee(i,r),i.id||(i.id=++f),null==i.fn&&(i.fn=n),i.stats=H(i.stats),i.times=H(i.times)}function U(e){var t=this;if(!(t instanceof U))return new U(e);t.benchmark=e,se(t)}function W(e){return e instanceof W?e:this instanceof W?t.assign(this,{timeStamp:t.now()},"string"==typeof e?{type:e}:e):new W(e)}function $(e,n){var r=this;if(!(r instanceof $))return new $(e,n);t.isPlainObject(e)?n=e:r.name=e,ee(r,n)}var H=t.partial(t.cloneDeepWith,t,(function(e){if(!t.isArray(e)&&!t.isPlainObject(e))return e}));function G(){return G=function(e,t){var r,i=n.amdD?n.amdO:F,o=M+"createFunction";return Q((n.amdD?"define.amd.":"Benchmark.")+o+"=function("+e+"){"+t+"}"),r=i[o],delete i[o],r},(G=z.browser&&(G("",'return"'+M+'"')||t.noop)()==M?G:i).apply(null,arguments)}function K(e,n){e._timerId=t.delay(n,1e3*e.delay)}function q(e){return t.reduce(e,(function(e,t){return e+t}))/e.length||0}function X(e){var n="";return Z(e)?n=c(e):z.decompilation&&(n=t.result(/^[^{]+\{([\s\S]*)\}\s*$/.exec(e),1)),n=(n||"").replace(/^\s+|\s+$/g,""),/^(?:\/\*+[\w\W]*?\*\/|\/\/.*?[\n\r\u2028\u2029]|\s)*(["'])use strict\1;?$/.test(n)?"":n}function Y(e,t){if(null==e)return!1;var n=typeof e[t];return!(p.test(n)||"object"==n&&!e[t])}function Z(e){return t.isString(e)||t.has(e,"toString")&&t.isFunction(e.toString)}function J(e){try{var t=l&&n(242)(e)}catch(e){}return t||null}function Q(e){var t=n.amdD?n.amdO:F,r=N.createElement("script"),i=N.getElementsByTagName("script")[0],o=i.parentNode,a=M+"runScript",u="("+(n.amdD?"define.amd.":"Benchmark.")+a+"||function(){})();";try{r.appendChild(N.createTextNode(u+e)),t[a]=function(){var e;e=r,R.appendChild(e),R.innerHTML=""}}catch(t){o=o.cloneNode(!1),i=null,r.text=e}o.insertBefore(r,i),delete t[a]}function ee(e,n){n=e.options=t.assign({},H(e.constructor.options),H(n)),t.forOwn(n,(function(n,r){null!=n&&(/^on[A-Z]/.test(r)?t.each(r.split(" "),(function(t){e.on(t.slice(2).toLowerCase(),n)})):t.has(e,r)||(e[r]=H(n)))}))}function te(e,n){if("successful"===n)n=function(e){return e.cycles&&t.isFinite(e.hz)&&!e.error};else if("fastest"===n||"slowest"===n){var r=te(e,"successful").sort((function(e,t){return e=e.stats,t=t.stats,(e.mean+e.moe>t.mean+t.moe?1:-1)*("fastest"===n?1:-1)}));return t.filter(r,(function(e){return 0==r[0].compare(e)}))}return t.filter(e,n)}function ne(e){return(e=c(e).split("."))[0].replace(/(?=(?:\d{3})+$)(?!\b)/g,",")+(e[1]?"."+e[1]:"")}function re(e,n){var r,i,a,u=-1,l={currentTarget:e},s={onStart:t.noop,onCycle:t.noop,onComplete:t.noop},c=t.toArray(e);function f(){var e,a=h(i);return a&&(i.on("complete",p),(e=i.events.complete).splice(0,0,e.pop())),c[u]=t.isFunction(i&&i[n])?i[n].apply(i,r):o,!a&&p()}function p(t){var n,r=i,o=h(r);if(o&&(r.off("complete",p),r.emit("complete")),l.type="cycle",l.target=r,n=W(l),s.onCycle.call(e,n),n.aborted||!1===b())l.type="complete",s.onComplete.call(e,W(l));else if(h(i=a?e[0]:c[u]))K(i,f);else{if(!o)return!0;for(;f(););}if(!t)return!1;t.aborted=!0}function h(e){var t=r[0]&&r[0].async;return"run"==n&&e instanceof F&&((null==t?e.options.async:t)&&z.timeout||e.defer)}function b(){return u++,a&&u>0&&E.call(e),(a?e.length:u>>0;return r||(r=": "),t.each(e,(function(e,t){i.push(a?e:t+r+e)})),i.join(n||",")}function oe(e){var n,r=this,i=W(e),o=r.events,a=(arguments[0]=i,arguments);return i.currentTarget||(i.currentTarget=r),i.target||(i.target=r),delete i.result,o&&(n=t.has(o,i.type)&&o[i.type])&&t.each(n.slice(),(function(e){return!1===(i.result=e.apply(r,a))&&(i.cancelled=!0),!i.aborted})),i.result}function ae(e){var n=this.events||(this.events={});return t.has(n,e)?n[e]:n[e]=[]}function ue(e,n){var r=this,i=r.events;return i?(t.each(e?e.split(" "):i,(function(e,r){var o;"string"==typeof e&&(r=e,e=t.has(i,r)&&i[r]),e&&(n?(o=t.indexOf(e,n))>-1&&e.splice(o,1):e.length=0)})),r):r}function le(e,n){var r=this,i=r.events||(r.events={});return t.each(e.split(" "),(function(e){(t.has(i,e)?i[e]:i[e]=[]).push(n)})),r}function se(){var n=F.options,r={},i=[{ns:B.ns,res:P(.0015,a("ms")),unit:"ms"}];function o(e,n,i,o){var a=e.fn,l=i?function(e){return!t.has(e,"toString")&&(/^[\s(]*function[^(]*\(([^\s,)]+)/.exec(e)||0)[1]||""}(a)||"deferred":"";return r.uid=M+h++,t.assign(r,{setup:n?X(e.setup):u("m#.setup()"),fn:n?X(a):u("m#.fn("+l+")"),fnArg:l,teardown:n?X(e.teardown):u("m#.teardown()")}),"ns"==B.unit?t.assign(r,{begin:u("s#=n#()"),end:u("r#=n#(s#);r#=r#[0]+(r#[1]/1e9)")}):"us"==B.unit?B.ns.stop?t.assign(r,{begin:u("s#=n#.start()"),end:u("r#=n#.microseconds()/1e6")}):t.assign(r,{begin:u("s#=n#()"),end:u("r#=(n#()-s#)/1e6")}):B.ns.now?t.assign(r,{begin:u("s#=n#.now()"),end:u("r#=(n#.now()-s#)/1e3")}):t.assign(r,{begin:u("s#=new n#().getTime()"),end:u("r#=(new n#().getTime()-s#)/1e3")}),B.start=G(u("o#"),u("var n#=this.ns,${begin};o#.elapsed=0;o#.timeStamp=s#")),B.stop=G(u("o#"),u("var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#")),G(u("window,t#"),"var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n"+u(o))}function a(e){for(var t,n,r=30,i=1e3,o=B.ns,a=[];r--;){if("us"==e)if(i=1e6,o.stop)for(o.start();!(t=o.microseconds()););else for(n=o();!(t=o()-n););else if("ns"==e){for(i=1e9,n=(n=o())[0]+n[1]/i;!(t=(t=o())[0]+t[1]/i-n););i=1}else if(o.now)for(n=o.now();!(t=o.now()-n););else for(n=(new o).getTime();!(t=(new o).getTime()-n););if(!(t>0)){a.push(1/0);break}a.push(t)}return q(a)/i}function u(e){return t.template(e.replace(/\#/g,/\d+/.exec(r.uid)))(r)}se=function(i){var a;i instanceof U&&(i=(a=i).benchmark);var u=i._original,l=Z(u.fn),s=u.count=i.count,f=l||z.decompilation&&(i.setup!==t.noop||i.teardown!==t.noop),p=u.id,h=u.name||("number"==typeof p?"":p),b=0;i.minTime=u.minTime||(u.minTime=u.options.minTime=n.minTime);var d=a?'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;if(!d#.cycles){d#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};d#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};t#.start(d#);}d#.fn();return{uid:"${uid}"}':'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}',v=u.compiled=i.compiled=o(u,f,a,d),y=!(r.fn||l);try{if(y)throw new Error('The test "'+h+'" is empty. This may be the result of dead code removal.');a||(u.count=1,v=f&&(v.call(u,e,B)||{}).uid==r.uid&&v,u.count=s)}catch(e){v=null,i.error=e||new Error(c(e)),u.count=s}if(!v&&!a&&!y){v=o(u,f,a,d=(l||f&&!i.error?"function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count":"var r#,s#,m#=this,f#=m#.fn,i#=m#.count")+",n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};delete m#.f#;${teardown}\nreturn{elapsed:r#}");try{u.count=1,v.call(u,e,B),u.count=s,delete i.error}catch(e){u.count=s,i.error||(i.error=e||new Error(c(e)))}}return i.error||(b=(v=u.compiled=i.compiled=o(u,f,a,d)).call(a||u,e,B).elapsed),b};try{(B.ns=new(e.chrome||e.chromium).Interval)&&i.push({ns:B.ns,res:a("us"),unit:"us"})}catch(e){}if(D&&"function"==typeof(B.ns=D.hrtime)&&i.push({ns:B.ns,res:a("ns"),unit:"ns"}),V&&"function"==typeof(B.ns=V.now)&&i.push({ns:B.ns,res:a("us"),unit:"us"}),(B=t.minBy(i,"res")).res==1/0)throw new Error("Benchmark.js was unable to find a working timer.");return n.minTime||(n.minTime=P(B.res/2/.01,.05)),se.apply(null,arguments)}function ce(t,n){var r;n||(n={}),t instanceof U&&(r=t,t=t.benchmark);var i,o,u,l,s,c,f=n.async,p=t._original,h=t.count,b=t.times;t.running&&(o=++t.cycles,i=r?r.elapsed:se(t),s=t.minTime,o>p.cycles&&(p.cycles=o),t.error&&((l=W("error")).message=t.error,t.emit(l),l.cancelled||t.abort())),t.running&&(p.times.cycle=b.cycle=i,c=p.times.period=b.period=i/h,p.hz=t.hz=1/c,p.initCount=t.initCount=h,t.running=ie?0:n30?(n=function(e){return(e-o*a/2)/C(o*a*(o+a+1)/12)}(f),w(n)>1.96?f==s?1:-1:0):f<=(u<5||l<3?0:y[u][l-3])?f==s?1:-1:0},emit:oe,listeners:ae,off:ue,on:le,reset:function(){var e=this;if(e.running&&!L.abort)return L.reset=!0,e.abort(),delete L.reset,e;var n,r=0,i=[],a=[],u={destination:e,source:t.assign({},H(e.constructor.prototype),H(e.options))};do{t.forOwn(u.source,(function(e,n){var r,l=u.destination,s=l[n];/^_|^events$|^on[A-Z]/.test(n)||(t.isObjectLike(e)?(t.isArray(e)?(t.isArray(s)||(r=!0,s=[]),s.length!=e.length&&(r=!0,(s=s.slice(0,e.length)).length=e.length)):t.isObjectLike(s)||(r=!0,s={}),r&&i.push({destination:l,key:n,value:s}),a.push({destination:s,source:e})):t.eq(s,e)||e===o||i.push({destination:l,key:n,value:e}))}))}while(u=a[r++]);return i.length&&(e.emit(n=W("reset")),!n.cancelled)&&t.each(i,(function(e){e.destination[e.key]=e.value})),e},run:function(e){var n=this,r=W("start");return n.running=!1,n.reset(),n.running=!0,n.count=n.initCount,n.times.timeStamp=t.now(),n.emit(r),r.cancelled||(e={async:(null==(e=e&&e.async)?n.async:e)&&z.timeout},n._original?n.defer?U(n):ce(n,e):function(e,n){n||(n={});var r=n.async,i=0,o=e.initCount,u=e.minSamples,l=[],s=e.stats.sample;function c(){l.push(t.assign(e.clone(),{_original:e,events:{abort:[f],cycle:[f],error:[f],start:[f]}}))}function f(t){var n=this,r=t.type;e.running?"start"==r?n.count=e.initCount:("error"==r&&(e.error=n.error),"abort"==r?(e.abort(),e.emit("cycle")):(t.currentTarget=t.target=e,e.emit(t))):e.aborted&&(n.events.abort.length=0,n.abort())}c(),re(l,{name:"run",args:{async:r},queued:!0,onCycle:function(n){var r,f,p,h,b,d,y,g=n.target,_=e.aborted,m=t.now(),w=s.push(g.times.period),O=w>=u&&(i+=m-g.times.timeStamp)/1e3>e.maxTime,j=e.times;(_||g.hz==1/0)&&(O=!(w=s.length=l.length=0)),_||(f=q(s),y=t.reduce(s,(function(e,t){return e+A(t-f,2)}),0)/(w-1)||0,r=w-1,h=(p=(d=(b=C(y))/C(w))*(v[a.round(r)||1]||v.infinity))/f*100||0,t.assign(e.stats,{deviation:b,mean:f,moe:p,rme:h,sem:d,variance:y}),O&&(e.initCount=o,e.running=!1,_=!0,j.elapsed=(m-j.timeStamp)/1e3),e.hz!=1/0&&(e.hz=1/f,j.cycle=f*e.count,j.period=f)),l.length<2&&!O&&c(),n.aborted=_},onComplete:function(){e.emit("complete")}})}(n,e)),n},toString:function(){var e=this,n=e.error,r=e.hz,i=e.id,o=e.stats,a=o.sample.length;return(e.name||(t.isNaN(i)?i:""))+(n?": "+(t.isObject(n)?t.isError(Error)?ie(t.assign({name:n.name,message:n.message},n)):ie(n):c(n)):" x "+ne(r.toFixed(r<100?2:0))+" ops/sec ±"+o.rme.toFixed(2)+"% ("+a+" run"+(1==a?"":"s")+" sampled)")}}),t.assign(U.prototype,{benchmark:null,cycles:0,elapsed:0,timeStamp:0}),t.assign(U.prototype,{resolve:function(){var t=this,n=t.benchmark;n._original.aborted?(t.teardown(),n.running=!1,ce(t)):++t.cycles{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=242,e.exports=t},486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",u="__lodash_placeholder__",l=32,s=128,c=1/0,f=9007199254740991,p=NaN,h=4294967295,b=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],d="[object Arguments]",v="[object Array]",y="[object Boolean]",g="[object Date]",_="[object Error]",m="[object Function]",w="[object GeneratorFunction]",O="[object Map]",j="[object Number]",P="[object Object]",S="[object Promise]",A="[object RegExp]",x="[object Set]",E="[object String]",T="[object Symbol]",C="[object WeakMap]",I="[object ArrayBuffer]",k="[object DataView]",N="[object Float32Array]",V="[object Float64Array]",D="[object Int8Array]",R="[object Int16Array]",M="[object Int32Array]",L="[object Uint8Array]",z="[object Uint8ClampedArray]",B="[object Uint16Array]",F="[object Uint32Array]",U=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,H=/&(?:amp|lt|gt|quot|#39);/g,G=/[&<>"']/g,K=RegExp(H.source),q=RegExp(G.source),X=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,ve=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",Oe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",je="\\u2700-\\u27bf",Pe="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",xe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+we+"]",Te="["+xe+"]",Ce="["+Oe+"]",Ie="\\d+",ke="["+je+"]",Ne="["+Pe+"]",Ve="[^"+we+xe+Ie+je+Pe+Se+"]",De="\\ud83c[\\udffb-\\udfff]",Re="[^"+we+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",Le="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Fe="(?:"+Ne+"|"+Ve+")",Ue="(?:"+ze+"|"+Ve+")",We="(?:['’](?:d|ll|m|re|s|t|ve))?",$e="(?:['’](?:D|LL|M|RE|S|T|VE))?",He="(?:"+Ce+"|"+De+")?",Ge="["+Ae+"]?",Ke=Ge+He+"(?:"+Be+"(?:"+[Re,Me,Le].join("|")+")"+Ge+He+")*",qe="(?:"+[ke,Me,Le].join("|")+")"+Ke,Xe="(?:"+[Re+Ce+"?",Ce,Me,Le,Ee].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(Ce,"g"),Je=RegExp(De+"(?="+De+")|"+Xe+Ke,"g"),Qe=RegExp([ze+"?"+Ne+"+"+We+"(?="+[Te,ze,"$"].join("|")+")",Ue+"+"+$e+"(?="+[Te,ze+Fe,"$"].join("|")+")",ze+"?"+Fe+"+"+We,ze+"+"+$e,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ie,qe].join("|"),"g"),et=RegExp("["+Be+we+Oe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[N]=it[V]=it[D]=it[R]=it[M]=it[L]=it[z]=it[B]=it[F]=!0,it[d]=it[v]=it[I]=it[y]=it[k]=it[g]=it[_]=it[m]=it[O]=it[j]=it[P]=it[A]=it[x]=it[E]=it[C]=!1;var ot={};ot[d]=ot[v]=ot[I]=ot[k]=ot[y]=ot[g]=ot[N]=ot[V]=ot[D]=ot[R]=ot[M]=ot[O]=ot[j]=ot[P]=ot[A]=ot[x]=ot[E]=ot[T]=ot[L]=ot[z]=ot[B]=ot[F]=!0,ot[_]=ot[m]=ot[C]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ut=parseFloat,lt=parseInt,st="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,ft=st||ct||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,bt=ht&&ht.exports===pt,dt=bt&&st.process,vt=function(){try{return ht&&ht.require&&ht.require("util").types||dt&&dt.binding&&dt.binding("util")}catch(e){}}(),yt=vt&&vt.isArrayBuffer,gt=vt&&vt.isDate,_t=vt&&vt.isMap,mt=vt&&vt.isRegExp,wt=vt&&vt.isSet,Ot=vt&&vt.isTypedArray;function jt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Pt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Qt(e,t){for(var n=e.length;n--&&zt(t,e[n],0)>-1;);return n}var en=$t({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=$t({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(e){return"\\"+at[e]}function rn(e){return et.test(e)}function on(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function an(e,t){return function(n){return e(t(n))}}function un(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),bn=function e(t){var n,r=(t=null==t?ft:bn.defaults(ft.Object(),t,bn.pick(ft,nt))).Array,ie=t.Date,we=t.Error,Oe=t.Function,je=t.Math,Pe=t.Object,Se=t.RegExp,Ae=t.String,xe=t.TypeError,Ee=r.prototype,Te=Oe.prototype,Ce=Pe.prototype,Ie=t["__core-js_shared__"],ke=Te.toString,Ne=Ce.hasOwnProperty,Ve=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Re=Ce.toString,Me=ke.call(Pe),Le=ft._,ze=Se("^"+ke.call(Ne).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=bt?t.Buffer:i,Fe=t.Symbol,Ue=t.Uint8Array,We=Be?Be.allocUnsafe:i,$e=an(Pe.getPrototypeOf,Pe),He=Pe.create,Ge=Ce.propertyIsEnumerable,Ke=Ee.splice,qe=Fe?Fe.isConcatSpreadable:i,Xe=Fe?Fe.iterator:i,Je=Fe?Fe.toStringTag:i,et=function(){try{var e=lo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),at=t.clearTimeout!==ft.clearTimeout&&t.clearTimeout,st=ie&&ie.now!==ft.Date.now&&ie.now,ct=t.setTimeout!==ft.setTimeout&&t.setTimeout,pt=je.ceil,ht=je.floor,dt=Pe.getOwnPropertySymbols,vt=Be?Be.isBuffer:i,Rt=t.isFinite,$t=Ee.join,dn=an(Pe.keys,Pe),vn=je.max,yn=je.min,gn=ie.now,_n=t.parseInt,mn=je.random,wn=Ee.reverse,On=lo(t,"DataView"),jn=lo(t,"Map"),Pn=lo(t,"Promise"),Sn=lo(t,"Set"),An=lo(t,"WeakMap"),xn=lo(Pe,"create"),En=An&&new An,Tn={},Cn=Mo(On),In=Mo(jn),kn=Mo(Pn),Nn=Mo(Sn),Vn=Mo(An),Dn=Fe?Fe.prototype:i,Rn=Dn?Dn.valueOf:i,Mn=Dn?Dn.toString:i;function Ln(e){if(eu(e)&&!Wa(e)&&!(e instanceof Un)){if(e instanceof Fn)return e;if(Ne.call(e,"__wrapped__"))return Lo(e)}return new Fn(e)}var zn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Bn(){}function Fn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function ar(e,t,n,r,o,a){var u,l=1&t,s=2&t,c=4&t;if(n&&(u=o?n(e,r,o,a):n(e)),u!==i)return u;if(!Qa(e))return e;var f=Wa(e);if(f){if(u=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Ne.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!l)return Ai(e,u)}else{var p=fo(e),h=p==m||p==w;if(Ka(e))return mi(e,l);if(p==P||p==d||h&&!o){if(u=s||h?{}:ho(e),!l)return s?function(e,t){return xi(e,co(e),t)}(e,function(e,t){return e&&xi(t,Iu(t),e)}(u,e)):function(e,t){return xi(e,so(e),t)}(e,nr(u,e))}else{if(!ot[p])return o?e:{};u=function(e,t,n){var r,i=e.constructor;switch(t){case I:return wi(e);case y:case g:return new i(+e);case k:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case N:case V:case D:case R:case M:case L:case z:case B:case F:return Oi(e,n);case O:return new i;case j:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case T:return r=e,Rn?Pe(Rn.call(r)):{}}}(e,p,l)}}a||(a=new Kn);var b=a.get(e);if(b)return b;a.set(e,u),ou(e)?e.forEach((function(r){u.add(ar(r,t,n,r,e,a))})):tu(e)&&e.forEach((function(r,i){u.set(i,ar(r,t,n,i,e,a))}));var v=f?i:(c?s?to:eo:s?Iu:Cu)(e);return St(v||e,(function(r,i){v&&(r=e[i=r]),Qn(u,i,ar(r,t,n,i,e,a))})),u}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Pe(e);r--;){var o=n[r],a=t[o],u=e[o];if(u===i&&!(o in e)||!a(u))return!1}return!0}function lr(e,t,n){if("function"!=typeof e)throw new xe(o);return Eo((function(){e.apply(i,n)}),t)}function sr(e,t,n,r){var i=-1,o=Tt,a=!0,u=e.length,l=[],s=t.length;if(!u)return l;n&&(t=It(t,Xt(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Gn(t));e:for(;++i-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(jn||$n),string:new Wn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Gn.prototype.add=Gn.prototype.push=function(e){return this.__data__.set(e,a),this},Gn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new $n,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ci(gr),fr=Ci(_r,!0);function pr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(u)?t>1?dr(u,t-1,n,r,i):kt(i,u):r||(i[i.length]=u)}return i}var vr=Ii(),yr=Ii(!0);function gr(e,t){return e&&vr(e,t,Cu)}function _r(e,t){return e&&yr(e,t,Cu)}function mr(e,t){return Et(t,(function(t){return Ya(e[t])}))}function wr(e,t){for(var n=0,r=(t=vi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Ne.call(e,t)}function Ar(e,t){return null!=e&&t in Pe(e)}function xr(e,t,n){for(var o=n?Ct:Tt,a=e[0].length,u=e.length,l=u,s=r(u),c=1/0,f=[];l--;){var p=e[l];l&&t&&(p=It(p,Xt(t))),c=yn(p.length,c),s[l]=!n&&(t||a>=120&&p.length>=120)?new Gn(l&&p):i}p=e[0];var h=-1,b=s[0];e:for(;++h=u?l:l*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)u!==e&&Ke.call(u,l,1),Ke.call(e,l,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?Ke.call(e,i,1):li(e,i)}}return e}function Hr(e,t){return e+ht(mn()*(t-e+1))}function Gr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=ht(t/2))&&(e+=e)}while(t);return n}function Kr(e,t){return To(Po(e,t,nl),e+"")}function qr(e){return Xn(zu(e))}function Xr(e,t){var n=zu(e);return ko(n,or(t,0,n.length))}function Yr(e,t,n,r){if(!Qa(e))return e;for(var o=-1,a=(t=vi(t,e)).length,u=a-1,l=e;null!=l&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!uu(a)&&(n?a<=t:a=200){var s=t?null:Gi(e);if(s)return ln(s);a=!1,i=Zt,l=new Gn}else l=t?[]:u;e:for(;++r=r?e:ei(e,t,n)}var _i=at||function(e){return ft.clearTimeout(e)};function mi(e,t){if(t)return e.slice();var n=e.length,r=We?We(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ue(t).set(new Ue(e)),t}function Oi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function ji(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=uu(e),u=t!==i,l=null===t,s=t==t,c=uu(t);if(!l&&!c&&!a&&e>t||a&&u&&s&&!l&&!c||r&&u&&s||!n&&s||!o)return 1;if(!r&&!a&&!c&&e1?n[o-1]:i,u=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,u&&yo(n[0],n[1],u)&&(a=o<3?i:a,o=1),t=Pe(t);++r-1?o[a?t[u]:u]:i}}function Ri(e){return Qi((function(t){var n=t.length,r=n,a=Fn.prototype.thru;for(e&&t.reverse();r--;){var u=t[r];if("function"!=typeof u)throw new xe(o);if(a&&!l&&"wrapper"==ro(u))var l=new Fn([],!0)}for(r=l?r:n;++r1&&m.reverse(),h&&f<_&&(m.length=f),this&&this!==ft&&this instanceof s&&(A=g||Vi(A)),A.apply(S,m)}}function Li(e,t){return function(n,r){return function(e,t,n,r){return gr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function zi(e,t){return function(n,r){var o;if(n===i&&r===i)return t;if(n!==i&&(o=n),r!==i){if(o===i)return r;"string"==typeof n||"string"==typeof r?(n=ai(n),r=ai(r)):(n=oi(n),r=oi(r)),o=e(n,r)}return o}}function Bi(e){return Qi((function(t){return t=It(t,Xt(oo())),Kr((function(n){var r=this;return e(t,(function(e){return jt(e,r,n)}))}))}))}function Fi(e,t){var n=(t=t===i?" ":ai(t)).length;if(n<2)return n?Gr(t,e):t;var r=Gr(t,pt(e/cn(t)));return rn(t)?gi(fn(r),0,e).join(""):r.slice(0,e)}function Ui(e){return function(t,n,o){return o&&"number"!=typeof o&&yo(t,n,o)&&(n=o=i),t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n,i){for(var o=-1,a=vn(pt((t-e)/(n||1)),0),u=r(a);a--;)u[i?a:++o]=e,e+=n;return u}(t,n,o=o===i?tl))return!1;var c=a.get(e),f=a.get(t);if(c&&f)return c==t&&f==e;var p=-1,h=!0,b=2&n?new Gn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return St(b,(function(n){var r="_."+n[0];t&n[1]&&!Tt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(ue):[]}(r),n)))}function Io(e){var t=0,n=0;return function(){var r=gn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ko(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,ia(e,n)}));function fa(e){var t=Ln(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Qi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&vo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:i}),new Fn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ba=Ei((function(e,t,n){Ne.call(e,n)?++e[n]:rr(e,n,1)})),da=Di(Uo),va=Di(Wo);function ya(e,t){return(Wa(e)?St:cr)(e,oo(t,3))}function ga(e,t){return(Wa(e)?At:fr)(e,oo(t,3))}var _a=Ei((function(e,t,n){Ne.call(e,n)?e[n].push(t):rr(e,n,[t])})),ma=Kr((function(e,t,n){var i=-1,o="function"==typeof t,a=Ha(e)?r(e.length):[];return cr(e,(function(e){a[++i]=o?jt(t,e,n):Er(e,t,n)})),a})),wa=Ei((function(e,t,n){rr(e,n,t)}));function Oa(e,t){return(Wa(e)?It:Rr)(e,oo(t,3))}var ja=Ei((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Pa=Kr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Fr(e,dr(t,1),[])})),Sa=st||function(){return ft.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,qi(e,s,i,i,i,i,t)}function xa(e,t){var n;if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ea=Kr((function(e,t,n){var r=1;if(n.length){var i=un(n,io(Ea));r|=l}return qi(e,r,t,n,i)})),Ta=Kr((function(e,t,n){var r=3;if(n.length){var i=un(n,io(Ta));r|=l}return qi(t,r,e,n,i)}));function Ca(e,t,n){var r,a,u,l,s,c,f=0,p=!1,h=!1,b=!0;if("function"!=typeof e)throw new xe(o);function d(t){var n=r,o=a;return r=a=i,f=t,l=e.apply(o,n)}function v(e){var n=e-c;return c===i||n>=t||n<0||h&&e-f>=u}function y(){var e=Sa();if(v(e))return g(e);s=Eo(y,function(e){var n=t-(e-c);return h?yn(n,u-(e-f)):n}(e))}function g(e){return s=i,b&&r?d(e):(r=a=i,l)}function _(){var e=Sa(),n=v(e);if(r=arguments,a=this,c=e,n){if(s===i)return function(e){return f=e,s=Eo(y,t),p?d(e):l}(c);if(h)return _i(s),s=Eo(y,t),d(c)}return s===i&&(s=Eo(y,t)),l}return t=du(t)||0,Qa(n)&&(p=!!n.leading,u=(h="maxWait"in n)?vn(du(n.maxWait)||0,t):u,b="trailing"in n?!!n.trailing:b),_.cancel=function(){s!==i&&_i(s),f=0,r=c=a=s=i},_.flush=function(){return s===i?l:g(Sa())},_}var Ia=Kr((function(e,t){return lr(e,1,t)})),ka=Kr((function(e,t,n){return lr(e,du(t)||0,n)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new xe(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Na.Cache||Hn),n}function Va(e){if("function"!=typeof e)throw new xe(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Hn;var Da=yi((function(e,t){var n=(t=1==t.length&&Wa(t[0])?It(t[0],Xt(oo())):It(dr(t,1),Xt(oo()))).length;return Kr((function(r){for(var i=-1,o=yn(r.length,n);++i=t})),Ua=Tr(function(){return arguments}())?Tr:function(e){return eu(e)&&Ne.call(e,"callee")&&!Ge.call(e,"callee")},Wa=r.isArray,$a=yt?Xt(yt):function(e){return eu(e)&&jr(e)==I};function Ha(e){return null!=e&&Ja(e.length)&&!Ya(e)}function Ga(e){return eu(e)&&Ha(e)}var Ka=vt||dl,qa=gt?Xt(gt):function(e){return eu(e)&&jr(e)==g};function Xa(e){if(!eu(e))return!1;var t=jr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ru(e)}function Ya(e){if(!Qa(e))return!1;var t=jr(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hu(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function eu(e){return null!=e&&"object"==typeof e}var tu=_t?Xt(_t):function(e){return eu(e)&&fo(e)==O};function nu(e){return"number"==typeof e||eu(e)&&jr(e)==j}function ru(e){if(!eu(e)||jr(e)!=P)return!1;var t=$e(e);if(null===t)return!0;var n=Ne.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&ke.call(n)==Me}var iu=mt?Xt(mt):function(e){return eu(e)&&jr(e)==A},ou=wt?Xt(wt):function(e){return eu(e)&&fo(e)==x};function au(e){return"string"==typeof e||!Wa(e)&&eu(e)&&jr(e)==E}function uu(e){return"symbol"==typeof e||eu(e)&&jr(e)==T}var lu=Ot?Xt(Ot):function(e){return eu(e)&&Ja(e.length)&&!!it[jr(e)]},su=Wi(Dr),cu=Wi((function(e,t){return e<=t}));function fu(e){if(!e)return[];if(Ha(e))return au(e)?fn(e):Ai(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=fo(e);return(t==O?on:t==x?ln:zu)(e)}function pu(e){return e?(e=du(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hu(e){var t=pu(e),n=t%1;return t==t?n?t-n:t:0}function bu(e){return e?or(hu(e),0,h):0}function du(e){if("number"==typeof e)return e;if(uu(e))return p;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=qt(e);var n=be.test(e);return n||ve.test(e)?lt(e.slice(2),n?2:8):he.test(e)?p:+e}function vu(e){return xi(e,Iu(e))}function yu(e){return null==e?"":ai(e)}var gu=Ti((function(e,t){if(wo(t)||Ha(t))xi(t,Cu(t),e);else for(var n in t)Ne.call(t,n)&&Qn(e,n,t[n])})),_u=Ti((function(e,t){xi(t,Iu(t),e)})),mu=Ti((function(e,t,n,r){xi(t,Iu(t),e,r)})),wu=Ti((function(e,t,n,r){xi(t,Cu(t),e,r)})),Ou=Qi(ir),ju=Kr((function(e,t){e=Pe(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&yo(t[0],t[1],o)&&(r=1);++n1),t})),xi(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Du=Qi((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return Au(e,n)}))}(e,t)}));function Ru(e,t){if(null==e)return{};var n=It(to(e),(function(e){return[e]}));return t=oo(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Mu=Ki(Cu),Lu=Ki(Iu);function zu(e){return null==e?[]:Yt(e,Cu(e))}var Bu=Ni((function(e,t,n){return t=t.toLowerCase(),e+(n?Fu(t):t)}));function Fu(e){return Xu(yu(e).toLowerCase())}function Uu(e){return(e=yu(e))&&e.replace(ge,en).replace(Ze,"")}var Wu=Ni((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),$u=Ni((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Hu=ki("toLowerCase"),Gu=Ni((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ku=Ni((function(e,t,n){return e+(n?" ":"")+Xu(t)})),qu=Ni((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Xu=ki("toUpperCase");function Yu(e,t,n){return e=yu(e),(t=n?i:t)===i?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Zu=Kr((function(e,t){try{return jt(e,i,t)}catch(e){return Xa(e)?e:new we(e)}})),Ju=Qi((function(e,t){return St(t,(function(t){t=Ro(t),rr(e,t,Ea(e[t],e))})),e}));function Qu(e){return function(){return e}}var el=Ri(),tl=Ri(!0);function nl(e){return e}function rl(e){return Nr("function"==typeof e?e:ar(e,1))}var il=Kr((function(e,t){return function(n){return Er(n,e,t)}})),ol=Kr((function(e,t){return function(n){return Er(e,n,t)}}));function al(e,t,n){var r=Cu(t),i=mr(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=mr(t,Cu(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ya(e);return St(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Ai(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function ul(){}var ll=Bi(It),sl=Bi(xt),cl=Bi(Dt);function fl(e){return go(e)?Wt(Ro(e)):function(e){return function(t){return wr(t,e)}}(e)}var pl=Ui(),hl=Ui(!0);function bl(){return[]}function dl(){return!1}var vl,yl=zi((function(e,t){return e+t}),0),gl=Hi("ceil"),_l=zi((function(e,t){return e/t}),1),ml=Hi("floor"),wl=zi((function(e,t){return e*t}),1),Ol=Hi("round"),jl=zi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new xe(o);return e=hu(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=gu,Ln.assignIn=_u,Ln.assignInWith=mu,Ln.assignWith=wu,Ln.at=Ou,Ln.before=xa,Ln.bind=Ea,Ln.bindAll=Ju,Ln.bindKey=Ta,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wa(e)?e:[e]},Ln.chain=fa,Ln.chunk=function(e,t,n){t=(n?yo(e,t,n):t===i)?1:vn(hu(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,u=0,l=r(pt(o/t));ao?0:o+n),(r=r===i||r>o?o:hu(r))<0&&(r+=o),r=n>r?0:bu(r);n>>0)?(e=yu(e))&&("string"==typeof t||null!=t&&!iu(t))&&!(t=ai(t))&&rn(e)?gi(fn(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new xe(o);return t=null==t?0:vn(hu(t),0),Kr((function(n){var r=n[t],i=gi(n,0,t);return r&&kt(i,r),jt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===i?1:hu(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ei(e,(t=r-(t=n||t===i?1:hu(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?ci(e,oo(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?ci(e,oo(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new xe(o);return Qa(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ca(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=pa,Ln.toArray=fu,Ln.toPairs=Mu,Ln.toPairsIn=Lu,Ln.toPath=function(e){return Wa(e)?It(e,Ro):uu(e)?[e]:Ai(Do(yu(e)))},Ln.toPlainObject=vu,Ln.transform=function(e,t,n){var r=Wa(e),i=r||Ka(e)||lu(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ya(o)?zn($e(e)):{}}return(i?St:gr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=ea,Ln.unionBy=ta,Ln.unionWith=na,Ln.uniq=function(e){return e&&e.length?ui(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ui(e,oo(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ui(e,i,t):[]},Ln.unset=function(e,t){return null==e||li(e,t)},Ln.unzip=ra,Ln.unzipWith=ia,Ln.update=function(e,t,n){return null==e?e:si(e,t,di(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:si(e,t,di(n),r)},Ln.values=zu,Ln.valuesIn=function(e){return null==e?[]:Yt(e,Iu(e))},Ln.without=oa,Ln.words=Yu,Ln.wrap=function(e,t){return Ra(di(t),e)},Ln.xor=aa,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=sa,Ln.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Yr)},Ln.zipWith=ca,Ln.entries=Mu,Ln.entriesIn=Lu,Ln.extend=_u,Ln.extendWith=mu,al(Ln,Ln),Ln.add=yl,Ln.attempt=Zu,Ln.camelCase=Bu,Ln.capitalize=Fu,Ln.ceil=gl,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=du(n))==n?n:0),t!==i&&(t=(t=du(t))==t?t:0),or(du(e),t,n)},Ln.clone=function(e){return ar(e,4)},Ln.cloneDeep=function(e){return ar(e,5)},Ln.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||ur(e,t,Cu(t))},Ln.deburr=Uu,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=_l,Ln.endsWith=function(e,t,n){e=yu(e),t=ai(t);var r=e.length,o=n=n===i?r:or(hu(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=za,Ln.escape=function(e){return(e=yu(e))&&q.test(e)?e.replace(G,tn):e},Ln.escapeRegExp=function(e){return(e=yu(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Wa(e)?xt:pr;return n&&yo(e,t,n)&&(t=i),r(e,oo(t,3))},Ln.find=da,Ln.findIndex=Uo,Ln.findKey=function(e,t){return Mt(e,oo(t,3),gr)},Ln.findLast=va,Ln.findLastIndex=Wo,Ln.findLastKey=function(e,t){return Mt(e,oo(t,3),_r)},Ln.floor=ml,Ln.forEach=ya,Ln.forEachRight=ga,Ln.forIn=function(e,t){return null==e?e:vr(e,oo(t,3),Iu)},Ln.forInRight=function(e,t){return null==e?e:yr(e,oo(t,3),Iu)},Ln.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Ln.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Ln.get=Su,Ln.gt=Ba,Ln.gte=Fa,Ln.has=function(e,t){return null!=e&&po(e,t,Sr)},Ln.hasIn=Au,Ln.head=Ho,Ln.identity=nl,Ln.includes=function(e,t,n,r){e=Ha(e)?e:zu(e),n=n&&!r?hu(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),au(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&zt(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hu(n);return i<0&&(i=vn(r+i,0)),zt(e,t,i)},Ln.inRange=function(e,t,n){return t=pu(t),n===i?(n=t,t=0):n=pu(n),function(e,t,n){return e>=yn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ou,Ln.isString=au,Ln.isSymbol=uu,Ln.isTypedArray=lu,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return eu(e)&&fo(e)==C},Ln.isWeakSet=function(e){return eu(e)&&"[object WeakSet]"==jr(e)},Ln.join=function(e,t){return null==e?"":$t.call(e,t)},Ln.kebabCase=Wu,Ln.last=Xo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=hu(n))<0?vn(r+o,0):yn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Lt(e,Ft,o,!0)},Ln.lowerCase=$u,Ln.lowerFirst=Hu,Ln.lt=su,Ln.lte=cu,Ln.max=function(e){return e&&e.length?hr(e,nl,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):i},Ln.mean=function(e){return Ut(e,nl)},Ln.meanBy=function(e,t){return Ut(e,oo(t,2))},Ln.min=function(e){return e&&e.length?hr(e,nl,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Dr):i},Ln.stubArray=bl,Ln.stubFalse=dl,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=wl,Ln.nth=function(e,t){return e&&e.length?Br(e,hu(t)):i},Ln.noConflict=function(){return ft._===this&&(ft._=Le),this},Ln.noop=ul,Ln.now=Sa,Ln.pad=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Fi(ht(i),n)+e+Fi(pt(i),n)},Ln.padEnd=function(e,t,n){e=yu(e);var r=(t=hu(t))?cn(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=mn();return yn(e+o*(t-e+ut("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Ln.reduce=function(e,t,n){var r=Wa(e)?Nt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,cr)},Ln.reduceRight=function(e,t,n){var r=Wa(e)?Vt:Ht,i=arguments.length<3;return r(e,oo(t,4),n,i,fr)},Ln.repeat=function(e,t,n){return t=(n?yo(e,t,n):t===i)?1:hu(t),Gr(yu(e),t)},Ln.replace=function(){var e=arguments,t=yu(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=h,r=yn(e,h);t=oo(t),e-=h;for(var i=Kt(r,t);++n=a)return e;var l=n-cn(r);if(l<1)return r;var s=u?gi(u,0,l).join(""):e.slice(0,l);if(o===i)return s+r;if(u&&(l+=s.length-l),iu(o)){if(e.slice(l).search(o)){var c,f=s;for(o.global||(o=Se(o.source,yu(pe.exec(o))+"g")),o.lastIndex=0;c=o.exec(f);)var p=c.index;s=s.slice(0,p===i?l:p)}}else if(e.indexOf(ai(o),l)!=l){var h=s.lastIndexOf(o);h>-1&&(s=s.slice(0,h))}return s+r},Ln.unescape=function(e){return(e=yu(e))&&K.test(e)?e.replace(H,hn):e},Ln.uniqueId=function(e){var t=++Ve;return yu(e)+t},Ln.upperCase=qu,Ln.upperFirst=Xu,Ln.each=ya,Ln.eachRight=ga,Ln.first=Ho,al(Ln,(vl={},gr(Ln,(function(e,t){Ne.call(Ln.prototype,t)||(vl[t]=e)})),vl),{chain:!1}),Ln.VERSION="4.17.21",St(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),St(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:vn(hu(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=yn(n,r.__takeCount__):r.__views__.push({size:yn(n,h),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),St(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),St(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),St(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(nl)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Kr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Er(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Va(oo(e)))},Un.prototype.slice=function(e,t){e=hu(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=hu(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(h)},gr(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,u=r?[1]:arguments,l=t instanceof Un,s=u[0],c=l||Wa(t),f=function(e){var t=o.apply(Ln,kt([e],u));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(l=c=!1);var p=this.__chain__,h=!!this.__actions__.length,b=a&&!p,d=l&&!h;if(!a&&c){t=d?t:new Un(this);var v=e.apply(t,u);return v.__actions__.push({func:pa,args:[f],thisArg:i}),new Fn(v,p)}return b&&d?e.apply(this,u):(v=this.thru(f),b?r?v.value()[0]:v.value():v)})})),St(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wa(i)?i:[],e)}return this[n]((function(n){return t.apply(Wa(n)?n:[],e)}))}})),gr(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Ne.call(Tn,r)||(Tn[r]=[]),Tn[r].push({name:t,func:n})}})),Tn[Mi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=Ai(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ai(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ai(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Bn;){var r=Lo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:i}),new Fn(t,this.__chain__)}return this.thru(Qo)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,Xe&&(Ln.prototype[Xe]=function(){return this}),Ln}();ft._=bn,(r=function(){return bn}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},795:function(e,t,n){var r;e=n.nmd(e),function(){"use strict";var i={function:!0,object:!0},o=i[typeof window]&&window||this,a=i[typeof t]&&t,u=i.object&&e&&!e.nodeType&&e,l=a&&u&&"object"==typeof n.g&&n.g;!l||l.global!==l&&l.window!==l&&l.self!==l||(o=l);var s=Math.pow(2,53)-1,c=/\bOpera/,f=Object.prototype,p=f.hasOwnProperty,h=f.toString;function b(e){return(e=String(e)).charAt(0).toUpperCase()+e.slice(1)}function d(e){return e=m(e),/^(?:webOS|i(?:OS|P))/.test(e)?e:b(e)}function v(e,t){for(var n in e)p.call(e,n)&&t(e[n],n,e)}function y(e){return null==e?b(e):h.call(e).slice(8,-1)}function g(e){return String(e).replace(/([ -])(?!$)/g,"$1?")}function _(e,t){var n=null;return function(e,t){var n=-1,r=e?e.length:0;if("number"==typeof r&&r>-1&&r<=s)for(;++n3?"WebKit":/\bOpera\b/.test(z)&&(/\bOPR\b/.test(t)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(t)&&!/^(?:Trident|EdgeHTML)$/.test(L)&&"WebKit"||!L&&/\bMSIE\b/i.test(t)&&("Mac OS"==U?"Tasman":"Trident")||"WebKit"==L&&/\bPlayStation\b(?! Vita\b)/i.test(z)&&"NetFront")&&(L=[u]),"IE"==z&&(u=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(t)||0)[1])?(z+=" Mobile",U="Windows Phone "+(/\+$/.test(u)?u:u+".x"),V.unshift("desktop mode")):/\bWPDesktop\b/i.test(t)?(z="IE Mobile",U="Windows Phone 8.x",V.unshift("desktop mode"),M||(M=(/\brv:([\d.]+)/.exec(t)||0)[1])):"IE"!=z&&"Trident"==L&&(u=/\brv:([\d.]+)/.exec(t))&&(z&&V.push("identifying as "+z+(M?" "+M:"")),z="IE",M=u[1]),R){if(f="global",p=null!=(s=n)?typeof s[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!s[f])y(u=n.runtime)==O?(z="Adobe AIR",U=u.flash.system.Capabilities.os):y(u=n.phantom)==S?(z="PhantomJS",M=(u=u.version||null)&&u.major+"."+u.minor+"."+u.patch):"number"==typeof C.documentMode&&(u=/\bTrident\/(\d+)/i.exec(t))?(M=[M,C.documentMode],(u=+u[1]+4)!=M[1]&&(V.push("IE "+M[1]+" mode"),L&&(L[1]=""),M[1]=u),M="IE"==z?String(M[1].toFixed(1)):M[0]):"number"==typeof C.documentMode&&/^(?:Chrome|Firefox)\b/.test(z)&&(V.push("masking as "+z+" "+M),z="IE",M="11.0",L=["Trident"],U="Windows");else if(A&&(N=(u=A.lang.System).getProperty("os.arch"),U=U||u.getProperty("os.name")+" "+u.getProperty("os.version")),x){try{M=n.require("ringo/engine").version.join("."),z="RingoJS"}catch(e){(u=n.system)&&u.global.system==n.system&&(z="Narwhal",U||(U=u[0].os||null))}z||(z="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(u=n.process)&&("object"==typeof u.versions&&("string"==typeof u.versions.electron?(V.push("Node "+u.versions.node),z="Electron",M=u.versions.electron):"string"==typeof u.versions.nw&&(V.push("Chromium "+M,"Node "+u.versions.node),z="NW.js",M=u.versions.nw)),z||(z="Node.js",N=u.arch,U=u.platform,M=(M=/[\d.]+/.exec(u.version))?M[0]:null));U=U&&d(U)}if(M&&(u=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(M)||/(?:alpha|beta)(?: ?\d)?/i.exec(t+";"+(R&&i.appMinorVersion))||/\bMinefield\b/i.test(t)&&"a")&&(D=/b/i.test(u)?"beta":"alpha",M=M.replace(RegExp(u+"\\+?$"),"")+("beta"==D?T:E)+(/\d+\+?/.exec(u)||"")),"Fennec"==z||"Firefox"==z&&/\b(?:Android|Firefox OS|KaiOS)\b/.test(U))z="Firefox Mobile";else if("Maxthon"==z&&M)M=M.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(B))"Xbox 360"==B&&(U=null),"Xbox 360"==B&&/\bIEMobile\b/.test(t)&&V.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(z)&&(!z||B||/Browser|Mobi/.test(z))||"Windows CE"!=U&&!/Mobi/i.test(t))if("IE"==z&&R)try{null===n.external&&V.unshift("platform preview")}catch(e){V.unshift("embedded")}else(/\bBlackBerry\b/.test(B)||/\bBB10\b/.test(t))&&(u=(RegExp(B.replace(/ +/g," *")+"/([.\\d]+)","i").exec(t)||0)[1]||M)?(U=((u=[u,/BB10/.test(t)])[1]?(B=null,F="BlackBerry"):"Device Software")+" "+u[0],M=null):this!=v&&"Wii"!=B&&(R&&I||/Opera/.test(z)&&/\b(?:MSIE|Firefox)\b/i.test(t)||"Firefox"==z&&/\bOS X (?:\d+\.){2,}/.test(U)||"IE"==z&&(U&&!/^Win/.test(U)&&M>5.5||/\bWindows XP\b/.test(U)&&M>8||8==M&&!/\bTrident\b/.test(t)))&&!c.test(u=e.call(v,t.replace(c,"")+";"))&&u.name&&(u="ing as "+u.name+((u=u.version)?" "+u:""),c.test(z)?(/\bIE\b/.test(u)&&"Mac OS"==U&&(U=null),u="identify"+u):(u="mask"+u,z=k?d(k.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(u)&&(U=null),R||(M=null)),L=["Presto"],V.push(u));else z+=" Mobile";(u=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(t)||0)[1])&&(u=[parseFloat(u.replace(/\.(\d)$/,".0$1")),u],"Safari"==z&&"+"==u[1].slice(-1)?(z="WebKit Nightly",D="alpha",M=u[1].slice(0,-1)):M!=u[1]&&M!=(u[2]=(/\bSafari\/([\d.]+\+?)/i.exec(t)||0)[1])||(M=null),u[1]=(/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(t)||0)[1],537.36==u[0]&&537.36==u[2]&&parseFloat(u[1])>=28&&"WebKit"==L&&(L=["Blink"]),R&&(b||u[1])?(L&&(L[1]="like Chrome"),u=u[1]||((u=u[0])<530?1:u<532?2:u<532.05?3:u<533?4:u<534.03?5:u<534.07?6:u<534.1?7:u<534.13?8:u<534.16?9:u<534.24?10:u<534.3?11:u<535.01?12:u<535.02?"13+":u<535.07?15:u<535.11?16:u<535.19?17:u<536.05?18:u<536.1?19:u<537.01?20:u<537.11?"21+":u<537.13?23:u<537.18?24:u<537.24?25:u<537.36?26:"Blink"!=L?"27":"28")):(L&&(L[1]="like Safari"),u=(u=u[0])<400?1:u<500?2:u<526?3:u<533?4:u<534?"4+":u<535?5:u<537?6:u<538?7:u<601?8:u<602?9:u<604?10:u<606?11:u<608?12:"12"),L&&(L[1]+=" "+(u+="number"==typeof u?".x":/[.+]/.test(u)?"":"+")),"Safari"==z&&(!M||parseInt(M)>45)?M=u:"Chrome"==z&&/\bHeadlessChrome/i.test(t)&&V.unshift("headless")),"Opera"==z&&(u=/\bzbov|zvav$/.exec(U))?(z+=" ",V.unshift("desktop mode"),"zvav"==u?(z+="Mini",M=null):z+="Mobile",U=U.replace(RegExp(" *"+u+"$"),"")):"Safari"==z&&/\bChrome\b/.exec(L&&L[1])?(V.unshift("desktop mode"),z="Chrome Mobile",M=null,/\bOS X\b/.test(U)?(F="Apple",U="iOS 4.3+"):U=null):/\bSRWare Iron\b/.test(z)&&!M&&(M=$("Chrome")),M&&0==M.indexOf(u=/[\d.]+$/.exec(U))&&t.indexOf("/"+u+"-")>-1&&(U=m(U.replace(u,""))),U&&-1!=U.indexOf(z)&&!RegExp(z+" OS").test(U)&&(U=U.replace(RegExp(" *"+g(z)+" *"),"")),L&&!/\b(?:Avant|Nook)\b/.test(z)&&(/Browser|Lunascape|Maxthon/.test(z)||"Safari"!=z&&/^iOS/.test(U)&&/\bSafari\b/.test(L[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(z)&&L[1])&&(u=L[L.length-1])&&V.push(u),V.length&&(V=["("+V.join("; ")+")"]),F&&B&&B.indexOf(F)<0&&V.push("on "+F),B&&V.push((/^on /.test(V[V.length-1])?"":"on ")+B),U&&(u=/ ([\d.+]+)$/.exec(U),l=u&&"/"==U.charAt(U.length-u[0].length-1),U={architecture:32,family:u&&!l?U.replace(u[0],""):U,version:u?u[1]:null,toString:function(){var e=this.version;return this.family+(e&&!l?" "+e:"")+(64==this.architecture?" 64-bit":"")}}),(u=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(N))&&!/\bi686\b/i.test(N)?(U&&(U.architecture=64,U.family=U.family.replace(RegExp(" *"+u),"")),z&&(/\bWOW64\b/i.test(t)||R&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(t))&&V.unshift("32-bit")):U&&/^OS X/.test(U.family)&&"Chrome"==z&&parseFloat(M)>=39&&(U.architecture=64),t||(t=null);var H={};return H.description=t,H.layout=L&&L[0],H.manufacturer=F,H.name=z,H.prerelease=D,H.product=B,H.ua=t,H.version=z&&M,H.os=U||{architecture:null,family:null,version:null,toString:function(){return"null"}},H.parse=e,H.toString=function(){return this.description||""},H.version&&V.unshift(M),H.name&&V.unshift(z),U&&z&&(U!=String(U).split(" ")[0]||U!=z.split(" ")[0]&&!B)&&V.push(B?"("+U+")":"on "+U),V.length&&(H.description=V.join(" ")),H}();o.platform=w,void 0===(r=function(){return w}.call(t,n,t,e))||(e.exports=r)}.call(this)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";function e(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var z=Symbol("mobx-stored-annotations");function B(e){return Object.assign((function(t,n){F(t,n,e)}),e)}function F(e,t,n){T(e,z)||w(e,z,N({},e[z])),function(e){return e.annotationType_===X}(n)||(e[z][t]=n)}var U=Symbol("mobx administration"),W=function(){function e(e){void 0===e&&(e="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.batchId_=void 0,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e,this.batchId_=ut.inBatch?ut.batchId:NaN}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return ht(this)},t.reportChanged=function(){ut.inBatch&&this.batchId_===ut.batchId||(ut.stateVersion=ut.stateVersionr&&(r=u.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];0===l.diffValue_&&st(l,e),l.diffValue_=0}for(;i--;){var s=n[i];1===s.diffValue_&&(s.diffValue_=0,lt(s,e))}r!==$e.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}(e),rt(r),i}function Je(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState_=$e.NOT_TRACKING_}function Qe(e){var t=et();try{return e()}finally{tt(t)}}function et(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function tt(e){ut.trackingDerivation=e}function nt(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function rt(e){ut.allowStateReads=e}function it(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=$e.UP_TO_DATE_}}var ot=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.batchId=Number.MIN_SAFE_INTEGER,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0,this.stateVersion=Number.MIN_SAFE_INTEGER},at=!0,ut=function(){var t=i();return t.__mobxInstanceCount>0&&!t.__mobxGlobals&&(at=!1),t.__mobxGlobals&&t.__mobxGlobals.version!==(new ot).version&&(at=!1),at?t.__mobxGlobals?(t.__mobxInstanceCount+=1,t.__mobxGlobals.UNCHANGED||(t.__mobxGlobals.UNCHANGED={}),t.__mobxGlobals):(t.__mobxInstanceCount=1,t.__mobxGlobals=new ot):(setTimeout((function(){e(35)}),1),new ot)}();function lt(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function st(e,t){e.observers_.delete(t),0===e.observers_.size&&ct(e)}function ct(e){!1===e.isPendingUnobservation_&&(e.isPendingUnobservation_=!0,ut.pendingUnobservations.push(e))}function ft(){0===ut.inBatch&&(ut.batchId=ut.batchId0&&ct(e),!1)}function bt(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach((function(e){e.dependenciesState_===$e.UP_TO_DATE_&&e.onBecomeStale_(),e.dependenciesState_=$e.STALE_})))}var dt=function(){function e(e,t,n,r){void 0===e&&(e="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=He.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,ut.pendingReactions.push(this),gt())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){ft(),this.isScheduled_=!1;var e=ut.trackingContext;if(ut.trackingContext=this,Ye(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(e){this.reportExceptionInDerivation_(e)}}ut.trackingContext=e,pt()}},t.track=function(e){if(!this.isDisposed_){ft(),this.isRunning_=!0;var t=ut.trackingContext;ut.trackingContext=this;var n=Ze(this,e,void 0);ut.trackingContext=t,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Je(this),Xe(n)&&this.reportExceptionInDerivation_(n.cause),pt()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_)this.errorHandler_(e,this);else{if(ut.disableErrorBoundaries)throw e;var n="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(n,e),ut.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(ft(),Je(this),pt()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),null==e||null==e.removeEventListener||e.removeEventListener("abort",n)};return null==e||null==e.addEventListener||e.addEventListener("abort",n),n[U]=this,n},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(e){void 0===e&&(e=!1)},e}(),vt=100,yt=function(e){return e()};function gt(){ut.inBatch>0||ut.isRunningReactions||yt(_t)}function _t(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===vt&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r",t,e):v(n)?Re(t,n,e):y(n)?F(t,n,e?St:jt):y(t)?B(Y(e?Ot:wt,{name:t,autoAction:e})):void 0}}var Et=xt(!1);Object.assign(Et,jt);var Tt=xt(!0);function Ct(e){return Me(e.name,!1,e,this,void 0)}function It(e){return v(e)&&!0===e.isMobxAction}function kt(e,t){var n,r,i,o,a;void 0===t&&(t=c);var u,l=null!=(n=null==(r=t)?void 0:r.name)?n:"Autorun";if(t.scheduler||t.delay){var s=Vt(t),f=!1;u=new dt(l,(function(){f||(f=!0,s((function(){f=!1,u.isDisposed_||u.track(p)})))}),t.onError,t.requiresObservable)}else u=new dt(l,(function(){this.track(p)}),t.onError,t.requiresObservable);function p(){e(u)}return null!=(i=t)&&null!=(o=i.signal)&&o.aborted||u.schedule_(),u.getDisposer_(null==(a=t)?void 0:a.signal)}Object.assign(Tt,St),Et.bound=B(Pt),Tt.bound=B(At);var Nt=function(e){return e()};function Vt(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Nt}var Dt="onBO",Rt="onBUO";function Mt(e,t,n){return Lt(Rt,e,t,n)}function Lt(e,t,n,r){var i="function"==typeof r?tr(t,n):tr(t),o=v(r)?r:n,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var e=i[a];e&&(e.delete(o),0===e.size&&delete i[a])}}var zt=0;function Bt(){this.message="FLOW_CANCELLED"}Bt.prototype=Object.create(Error.prototype);var Ft=ee("flow"),Ut=ee("flow.bound",{bound:!0}),Wt=Object.assign((function(e,t){if(y(t))return F(e,t,Ft);var n=e,r=n.name||"",i=function(){var e,t=arguments,i=++zt,o=Et(r+" - runid: "+i+" - init",n).apply(this,t),a=void 0,u=new Promise((function(t,n){var u=0;function l(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.next).call(o,e)}catch(e){return n(e)}c(t)}function s(e){var t;a=void 0;try{t=Et(r+" - runid: "+i+" - yield "+u++,o.throw).call(o,e)}catch(e){return n(e)}c(t)}function c(e){if(!v(null==e?void 0:e.then))return e.done?t(e.value):(a=Promise.resolve(e.value)).then(l,s);e.then(c,n)}e=n,l(void 0)}));return u.cancel=Et(r+" - runid: "+i+" - cancel",(function(){try{a&&$t(a);var t=o.return(void 0),n=Promise.resolve(t.value);n.then(d,d),$t(n),e(new Bt)}catch(t){e(t)}})),u};return i.isMobXFlow=!0,i}),Ft);function $t(e){v(e.cancel)&&e.cancel()}function Ht(e){return!0===(null==e?void 0:e.isMobXFlow)}function Gt(e,t,n){var r;return kn(e)||Sn(e)||We(e)?r=nr(e):Un(e)&&(r=nr(e,t)),r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0}}function Kt(e,t,n){return v(n)?function(e,t,n){return nr(e,t).intercept_(n)}(e,t,n):function(e,t){return nr(e).intercept_(t)}(e,t)}function qt(e){return function(e,t){return!!e&&(void 0!==t?!!Un(e)&&e[U].values_.has(t):Un(e)||!!e[U]||$(e)||mt(e)||Ke(e))}(e)}function Xt(t){return Un(t)?t[U].keys_():kn(t)||Dn(t)?Array.from(t.keys()):Sn(t)?t.map((function(e,t){return t})):void e(5)}function Yt(t){return Un(t)?Xt(t).map((function(e){return t[e]})):kn(t)?Xt(t).map((function(e){return t.get(e)})):Dn(t)?Array.from(t.values()):Sn(t)?t.slice():void e(6)}function Zt(t,n,r){if(2!==arguments.length||Dn(t))Un(t)?t[U].set_(n,r):kn(t)?t.set(n,r):Dn(t)?t.add(n):Sn(t)?("number"!=typeof n&&(n=parseInt(n,10)),n<0&&e("Invalid index: '"+n+"'"),ft(),n>=t.length&&(t.length=n+1),t[n]=r,pt()):e(8);else{ft();var i=n;try{for(var o in i)Zt(t,o,i[o])}finally{pt()}}}function Jt(t,n,r){if(Un(t))return t[U].defineProperty_(n,r);e(39)}function Qt(e,t,n,r){return v(n)?function(e,t,n,r){return nr(e,t).observe_(n,r)}(e,t,n,r):function(e,t,n){return nr(e).observe_(t,n)}(e,t,n)}function en(e,t){void 0===t&&(t=void 0),ft();try{return e.apply(t)}finally{pt()}}function tn(e,t,n){return 1===arguments.length||t&&"object"==typeof t?function(e,t){var n,r,i;if(null!=t&&null!=(n=t.signal)&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var o=new Promise((function(n,o){var a,u=nn(e,n,N({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},null==t||null==(a=t.signal)||null==a.addEventListener||a.addEventListener("abort",i)})).finally((function(){var e;return null==t||null==(e=t.signal)||null==e.removeEventListener?void 0:e.removeEventListener("abort",i)}));return o.cancel=r,o}(e,t):nn(e,t,n||{})}function nn(e,t,n){var r;if("number"==typeof n.timeout){var i=new Error("WHEN_TIMEOUT");r=setTimeout((function(){if(!a[U].isDisposed_){if(a(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name="When";var o=Re("When-effect",t),a=kt((function(t){Le(!1,e)&&(t.dispose(),r&&clearTimeout(r),o())}),n);return a}function rn(e){return e[U]}Wt.bound=B(Ut);var on={has:function(e,t){return rn(e).has_(t)},get:function(e,t){return rn(e).get_(t)},set:function(e,t,n){var r;return!!y(t)&&(null==(r=rn(e).set_(t,n,!0))||r)},deleteProperty:function(e,t){var n;return!!y(t)&&(null==(n=rn(e).delete_(t,!0))||n)},defineProperty:function(e,t,n){var r;return null==(r=rn(e).defineProperty_(t,n))||r},ownKeys:function(e){return rn(e).ownKeys_()},preventExtensions:function(t){e(13)}};function an(e){return void 0!==e.interceptors_&&e.interceptors_.length>0}function un(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function ln(t,n){var r=et();try{for(var i=[].concat(t.interceptors_||[]),o=0,a=i.length;o0}function cn(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),b((function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}))}function fn(e,t){var n=et(),r=e.changeListeners_;if(r){for(var i=0,o=(r=r.slice()).length;i0?e.map(this.dehancer):e},n.intercept_=function(e){return un(this,e)},n.observe_=function(e,t){return void 0===t&&(t=!1),t&&e({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),cn(this,e)},n.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},n.setArrayLength_=function(t){("number"!=typeof t||isNaN(t)||t<0)&&e("Out of range: "+t);var n=this.values_.length;if(t!==n)if(t>n){for(var r=new Array(t-n),i=0;i0&&Qn(t+n+1)},n.spliceWithArray_=function(e,t,n){var r=this;this.atom_;var i=this.values_.length;if(void 0===e?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=1===arguments.length?i-e:null==t?0:Math.max(0,Math.min(t,i-e)),void 0===n&&(n=s),an(this)){var o=ln(this,{object:this.proxy_,type:pn,index:e,removedCount:t,added:n});if(!o)return s;t=o.removedCount,n=o.added}if(n=0===n.length?n:n.map((function(e){return r.enhancer_(e,void 0)})),this.legacyMode_){var a=n.length-t;this.updateArrayLength_(i,a)}var u=this.spliceItemsIntoValues_(e,t,n);return 0===t&&0===n.length||this.notifyArraySplice_(e,n,u),this.dehanceValues_(u)},n.spliceItemsIntoValues_=function(e,t,n){var r;if(n.length<1e4)return(r=this.values_).splice.apply(r,[e,t].concat(n));var i=this.values_.slice(e,e+t),o=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var a=0;a=this.values_.length))return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e]);console.warn("[mobx] Out of bounds read: "+e)},n.set_=function(t,n){var r=this.values_;if(this.legacyMode_&&t>r.length&&e(17,t,r.length),t2?n-2:0),i=2;i-1&&(this.splice(n,1),!0)}};function gn(e,t){"function"==typeof Array.prototype[e]&&(yn[e]=t(e))}function _n(e){return function(){var t=this[U];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function mn(e){return function(t,n){var r=this,i=this[U];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((function(e,i){return t.call(n,e,i,r)}))}}function wn(e){return function(){var t=this,n=this[U];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}gn("concat",_n),gn("flat",_n),gn("includes",_n),gn("indexOf",_n),gn("join",_n),gn("lastIndexOf",_n),gn("slice",_n),gn("toString",_n),gn("toLocaleString",_n),gn("every",mn),gn("filter",mn),gn("find",mn),gn("findIndex",mn),gn("flatMap",mn),gn("forEach",mn),gn("map",mn),gn("some",mn),gn("reduce",wn),gn("reduceRight",wn);var On,jn,Pn=j("ObservableArrayAdministration",dn);function Sn(e){return g(e)&&Pn(e[U])}var An={},xn="add",En="delete";On=Symbol.iterator,jn=Symbol.toStringTag;var Tn,Cn,In=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[U]=An,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=r,v(Map)||e(18),ir((function(){i.keysAtom_=H("ObservableMap.keys()"),i.data_=new Map,i.hasMap_=new Map,t&&i.merge(t)}))}var n=t.prototype;return n.has_=function(e){return this.data_.has(e)},n.has=function(e){var t=this;if(!ut.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Ue(this.has_(e),q,"ObservableMap.key?",!1);this.hasMap_.set(e,r),Mt(r,(function(){return t.hasMap_.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.has_(e);if(an(this)){var r=ln(this,{type:n?hn:xn,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},n.delete=function(e){var t=this;if(this.keysAtom_,an(this)&&!ln(this,{type:En,object:this,name:e}))return!1;if(this.has_(e)){var n=sn(this),r=n?{observableKind:"map",debugObjectName:this.name_,type:En,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return en((function(){var n;t.keysAtom_.reportChanged(),null==(n=t.hasMap_.get(e))||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.updateValue_=function(e,t){var n=this.data_.get(e);if((t=n.prepareNewValue_(t))!==ut.UNCHANGED){var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,oldValue:n.value_,name:e,newValue:t}:null;n.setNewValue_(t),r&&fn(this,i)}},n.addValue_=function(e,t){var n=this;this.keysAtom_,en((function(){var r,i=new Ue(t,n.enhancer_,"ObservableMap.key",!1);n.data_.set(e,i),t=i.value_,null==(r=n.hasMap_.get(e))||r.setNewValue_(!0),n.keysAtom_.reportChanged()}));var r=sn(this),i=r?{observableKind:"map",debugObjectName:this.name_,type:xn,object:this,name:e,newValue:t}:null;r&&fn(this,i)},n.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},n.values=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},n.entries=function(){var e=this,t=this.keys();return sr({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[On]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value,o=i[0],a=i[1];e.call(t,a,o,this)}},n.merge=function(t){var n=this;return kn(t)&&(t=new Map(t)),en((function(){_(t)?function(e){var t=Object.keys(e);if(!A)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return l.propertyIsEnumerable.call(e,t)}))):t}(t).forEach((function(e){return n.set(e,t[e])})):Array.isArray(t)?t.forEach((function(e){var t=e[0],r=e[1];return n.set(t,r)})):P(t)?(t.constructor!==Map&&e(19,t),t.forEach((function(e,t){return n.set(t,e)}))):null!=t&&e(20,t)})),this},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.keys());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.replace=function(t){var n=this;return en((function(){for(var r,i=function(t){if(P(t)||kn(t))return t;if(Array.isArray(t))return new Map(t);if(_(t)){var n=new Map;for(var r in t)n.set(r,t[r]);return n}return e(21,t)}(t),o=new Map,a=!1,u=L(n.data_.keys());!(r=u()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))a=!0;else{var s=n.data_.get(l);o.set(l,s)}}for(var c,f=L(i.entries());!(c=f()).done;){var p=c.value,h=p[0],b=p[1],d=n.data_.has(h);if(n.set(h,b),n.data_.has(h)){var v=n.data_.get(h);o.set(h,v),d||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var y=n.data_.keys(),g=o.keys(),m=y.next(),w=g.next();!m.done;){if(m.value!==w.value){n.keysAtom_.reportChanged();break}m=y.next(),w=g.next()}n.data_=o})),this},n.toString=function(){return"[object ObservableMap]"},n.toJSON=function(){return Array.from(this)},n.observe_=function(e,t){return cn(this,e)},n.intercept_=function(e){return un(this,e)},k(t,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:jn,get:function(){return"Map"}}]),t}(),kn=j("ObservableMap",In),Nn={};Tn=Symbol.iterator,Cn=Symbol.toStringTag;var Vn=function(){function t(t,n,r){var i=this;void 0===n&&(n=K),void 0===r&&(r="ObservableSet"),this.name_=void 0,this[U]=Nn,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||e(22),this.enhancer_=function(e,t){return n(e,t,r)},ir((function(){i.atom_=H(i.name_),t&&i.replace(t)}))}var n=t.prototype;return n.dehanceValue_=function(e){return void 0!==this.dehancer?this.dehancer(e):e},n.clear=function(){var e=this;en((function(){Qe((function(){for(var t,n=L(e.data_.values());!(t=n()).done;){var r=t.value;e.delete(r)}}))}))},n.forEach=function(e,t){for(var n,r=L(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(this.atom_,an(this)&&!ln(this,{type:xn,object:this,newValue:e}))return this;if(!this.has(e)){en((function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()}));var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:xn,object:this,newValue:e}:null;n&&fn(this,r)}return this},n.delete=function(e){var t=this;if(an(this)&&!ln(this,{type:En,object:this,oldValue:e}))return!1;if(this.has(e)){var n=sn(this),r=n?{observableKind:"set",debugObjectName:this.name_,type:En,object:this,oldValue:e}:null;return en((function(){t.atom_.reportChanged(),t.data_.delete(e)})),n&&fn(this,r),!0}return!1},n.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},n.entries=function(){var e=0,t=Array.from(this.keys()),n=Array.from(this.values());return sr({next:function(){var r=e;return e+=1,rqn){for(var t=qn;t=0&&n++}e=lr(e),t=lr(t);var u="[object Array]"===a;if(!u){if("object"!=typeof e||"object"!=typeof t)return!1;var l=e.constructor,s=t.constructor;if(l!==s&&!(v(l)&&l instanceof l&&v(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}if(0===n)return!1;n<0&&(n=-1),i=i||[];for(var c=(r=r||[]).length;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),u){if((c=e.length)!==t.length)return!1;for(;c--;)if(!ur(e[c],t[c],n-1,r,i))return!1}else{var f,p=Object.keys(e);if(c=p.length,Object.keys(t).length!==c)return!1;for(;c--;)if(!T(t,f=p[c])||!ur(e[f],t[f],n-1,r,i))return!1}return r.pop(),i.pop(),!0}function lr(e){return Sn(e)?e.slice():P(e)||kn(e)||S(e)||Dn(e)?Array.from(e.entries()):e}function sr(e){return e[Symbol.iterator]=cr,e}function cr(){return this}["Symbol","Map","Set"].forEach((function(t){void 0===i()[t]&&e("MobX requires global '"+t+"' to be available or polyfilled")})),"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:function(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}},extras:{getDebugName:rr},$mobx:U});var fr;!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(fr||(fr={}));var pr=function(e,t){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},pr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}pr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var br=function(){return br=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vr(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function yr(){for(var e=[],t=0;t";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.fireInternalHook(e)}}),t}(Or);jr.prototype.die=Et(jr.prototype.die);var Pr,Sr,Ar=1,xr={onError:function(e){throw e}},Er=function(e){function t(t,n,r,i,o){var a=e.call(this,t,n,r,i)||this;if(Object.defineProperty(a,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++Ar}),Object.defineProperty(a,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(a,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(a,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a._snapshotComputed=Ce((function(){return a.getSnapshot()})),a.unbox=a.unbox.bind(a),a._initialSnapshot=o,a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Xr),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var u=a._initialSnapshot[a.identifierAttribute];if(void 0===u){var l=a._childNodes[a.identifierAttribute];l&&(u=l.value)}if("string"!=typeof u&&"number"!=typeof u)throw si("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Co(u),a.unnormalizedIdentifier=u}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return hr(t,e),Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){void 0===e&&(e=!0),0===this._observableInstanceState&&this.createObservableInstance(e)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n,r,i;void 0===e&&(e=!0),this._observableInstanceState=1;for(var o=[],a=this.parent;a&&0===a._observableInstanceState;)o.unshift(a),a=a.parent;try{for(var u=dr(o),l=u.next();!l.done;l=u.next())(p=l.value).createObservableInstanceIfNeeded(!1)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}var s=this.type;try{this.storedValue=s.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,s.finalizeNewInstance(this,this.storedValue)}catch(e){throw this.state=Kr.DEAD,e}finally{this._isRunningAction=!1}if(this._observableInstanceState=2,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=ui,this.state=Kr.CREATED,e){this.fireHook(fr.afterCreate),this.finalizeCreation();try{for(var c=dr(o.reverse()),f=c.next();!f.done;f=c.next()){var p;(p=f.value).fireHook(fr.afterCreate),p.finalizeCreation()}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(fr.beforeDetach);var e=this.state;this.state=Kr.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(fr.afterAttach)):r&&this.baseSetParent(this.parent,t))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"==typeof this.storedValue&&this.storedValue[e];"function"==typeof n&&(Ct?Ct((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,n="warn";if(!this.isAlive){var r=this._getAssertAliveError(e);switch(n){case"error":throw si(r);case"warn":t=r,console.warn(new Error("[mobx-state-tree] "+t))}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&xi(e.subpath)||"",r=e.actionContext||Rr;r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var i,o="";return r&&null!=r.name&&(o=(r&&r.context&&(Qr(i=r.context,1),ei(i).path)||t)+"."+r.name+"()"),"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive(ui),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):ii(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type.getChildType(e)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw si("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.type.removeChild(this,e)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=dr(e.getChildren()),i=r.next();!i.done;i=r.next())i.value.finalizeCreation()}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(fr.afterCreationFinalization)}))}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw si("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._applyPatches=Lr(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){if(t.path){var n=function(e){var t=e.split("/").map(Ei);if(!(""===e||"."===e||".."===e||Oi(e,"/")||Oi(e,"./")||Oi(e,"../")))throw si("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}(t.path);ri(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}else e.type.applySnapshot(e,t.value)}))})),this._applySnapshot=Lr(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),gi(this.storedValue,"$treenode",this),gi(this.storedValue,"toJSON",ni)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAlive&&this.state!==Kr.DETACHING&&(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._internalEventsEmit("snapshot",e)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._internalEventsRegister("patch",e)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=function(e){for(var t=[],n=1;n=0&&this.middlewares.splice(t,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(!this._hasSnapshotReaction){var t=function(t,n,r){var i,o,a,u;void 0===r&&(r=c);var l,s,f,p,h=null!=(i=r.name)?i:"Reaction",b=Et(h,r.onError?(l=r.onError,s=n,function(){try{return s.apply(this,arguments)}catch(e){l.call(this,e)}}):n),d=!r.scheduler&&!r.delay,v=Vt(r),y=!0,g=!1,_=r.compareStructural?G.structural:r.equals||G.default,m=new dt(h,(function(){y||d?w():g||(g=!0,v(w))}),r.onError,r.requiresObservable);function w(){if(g=!1,!m.isDisposed_){var t=!1;m.track((function(){var n=Le(!1,(function(){return e.snapshot}));t=y||!_(f,n),p=f,f=n})),(y&&r.fireImmediately||!y&&t)&&b(f,p,m),y=!1}}return null!=(o=r)&&null!=(a=o.signal)&&a.aborted||m.schedule_(),m.getDisposer_(null==(u=r)?void 0:u.signal)}(0,(function(t){return e.emitSnapshot(t)}),xr);this.addDisposer(t),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new mi),this._internalEvents.register(e,t,n)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,n=[],r=1;r0},enumerable:!1,configurable:!0})}();var Rr,Mr=1;function Lr(e,t,n){var r=function(){var r=Mr++,i=Rr,o=function(e){if(e)return"action"===e.type?e:e.parentActionEvent}(i);return function(e,t){var n=ei(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Rr;Rr=e;try{return function(e,t,n){var r=new zr(e,n);if(r.isEmpty)return Et(n).apply(null,t.args);var i=null;return function e(t){var o=r.getNextMiddleware(),a=o&&o.handler;return a?!o.includeHooks&&fr[t.name]?e(t):(a(t,(function(t,n){i=e(t),n&&(i=n(i))}),(function(e){i=e})),i):Et(n).apply(null,t.args)}(t)}(n,e,t)}finally{Rr=i,n._isRunningAction=r}}({type:"action",name:t,id:r,args:wi(arguments),context:e,tree:wr(e),rootId:i?i.rootId:r,parentId:i?i.id:0,allParentIds:i?yr(i.allParentIds,[i.id]):[],parentEvent:i,parentActionEvent:o},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var zr=function(){function e(e,t){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.middlewares[this.arrayIndex];if(e)return e[this.inArrayIndex++]||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}),e}();function Br(e){return"function"==typeof e?"":Jr(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(e){return""}}(e)+"`"}function Fr(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=Jr(t)?"value of type "+ei(t).type.name+":":vi(t)?"value":"snapshot",a=n&&Jr(t)&&n.is(ei(t).snapshot);return""+i+o+" "+Br(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?function(e){return Vr(e)&&(e.flags&(Sr.String|Sr.Number|Sr.Integer|Sr.Boolean|Sr.Date))>0}(n)||vi(t)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function Ur(e,t,n){return e.concat([{path:t,type:n}])}function Wr(){return ai}function $r(e,t,n){return[{context:e,value:t,message:n}]}function Hr(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Gr(e,t){"undefined"!=typeof process&&process.env&&"true"===process.env.ENABLE_TYPE_CHECK&&function(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw si(function(e,t,n){var r;if(0!==n.length)return"Error while converting "+(((r=Br(t)).length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Fr).join("\n ")}(e,t,n))}(e,t)}var Kr,qr=0,Xr=function(){function t(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:qr++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:Ae.map()})}return Object.defineProperty(t.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)}}),Object.defineProperty(t.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t}}),Object.defineProperty(t.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,Ae.array([],li));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw si("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}}}),Object.defineProperty(t.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;Yt(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))}}),Object.defineProperty(t.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}}}),Object.defineProperty(t.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i=this,o=new t,a=n.path+"/";return(r=this.cache,Un(r)?Xt(r).map((function(e){return[e,r[e]]})):kn(r)?Xt(r).map((function(e){return[e,r.get(e)]})):Dn(r)?Array.from(r.entries()):Sn(r)?r.map((function(e,t){return[t,e]})):void e(7)).forEach((function(e){for(var t=vr(e,2),r=t[0],u=t[1],l=!1,s=u.length-1;s>=0;s--){var c=u[s];c!==n&&0!==c.path.indexOf(a)||(o.addNodeToCache(c,!1),u.splice(s,1),u.length||i.cache.delete(r),l=!0)}l&&i.updateLastCacheModificationPerId(r)})),o}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))}}),Object.defineProperty(t.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw si("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}}}),t}();function Yr(e,t,n,r,i){var o=ti(i);if(o){if(o.parent)throw si("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+o.path+"'");return t&&o.setParent(t,n),o}return new Er(e,t,n,r,i)}function Zr(e,t,n,r,i){return new jr(e,t,n,r,i)}function Jr(e){return!(!e||!e.$treenode)}function Qr(e,t){ji()}function ei(e){if(!Jr(e))throw si("Value "+e+" is no MST Node");return e.$treenode}function ti(e){return e&&e.$treenode||null}function ni(){return ei(this).snapshot}function ri(e,t,n){void 0===n&&(n=!0);var r=e;try{for(var i=0;i0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.handlers.indexOf(e)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t0||(e.getReconciliationType=function(){return t})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?r:this.preProcessSnapshot(r),o=this._subtype.instantiate(e,t,n,i);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this._subtype.reconcile(e,Jr(t)?t:this.preProcessSnapshot(t),n,r);return i!==e&&this._fixNode(i),i}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.preProcessSnapshotSafe(e);return n===Ii?$r(t,e,"Failed to preprocess value"):this._subtype.validate(n,t)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Vr(e)?this._subtype:Jr(e)?mr(e,!1):this.preProcessSnapshotSafe(e);return t!==Ii&&0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!(this._subtype instanceof kr))return!1;var n=this.preProcessSnapshot(t);return this._subtype.isMatchingSnapshotId(e,n)}}),t}(Ir),Ni="Map.put can only be used to store complex values that have an identifier type attribute";function Vi(e,t){var n,r,i=e.getSubTypes();if(i===Tr)return!1;if(i){var o=hi(i);try{for(var a=dr(o),u=a.next();!u.done;u=a.next())if(!Vi(u.value,t))return!1}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}return e instanceof Hi&&t.push(e),!0}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ci||(Ci={}));var Di=function(e){function t(t,n){return e.call(this,t,Ae.ref.enhancer,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.get.call(this,""+t)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.has.call(this,""+t)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.prototype.delete.call(this,""+t)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return e.prototype.set.call(this,""+t,n)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!e)throw si("Map.put cannot be used to set empty values");if(Jr(e)){var t=ei(e);if(null===t.identifier)throw si(Ni);return this.set(t.identifier,e),e}if(di(e)){var n=ei(this),r=n.type;if(r.identifierMode!==Ci.YES)throw si(Ni);var i=e[r.mapIdentifierAttribute];if(!Io(i)){var o=this.put(r.getChildType().create(e,n.environment));return this.put(mr(o))}var a=Co(i);return this.set(a,e),this.get(a)}throw si("Map.put can only be used to store complex values")}}),t}(In),Ri=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:Ci.UNKNOWN}),Object.defineProperty(i,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Map}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i._determineIdentifierMode(),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._determineIdentifierMode(),Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===Ci.UNKNOWN){var e=[];if(Vi(this._subType,e)){var t=e.reduce((function(e,t){if(!t.identifierAttribute)return e;if(e&&e!==t.identifierAttribute)throw si("The objects in a map should all have the same identifier attribute, expected '"+e+"', but child of type '"+t.name+"' declared attribute '"+t.identifierAttribute+"' as identifier");return t.identifierAttribute}),void 0);t?(this.identifierMode=Ci.YES,this.mapIdentifierAttribute=t):this.identifierMode=Ci.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t={});var n=e.type._subType,r={};return Object.keys(t).forEach((function(i){r[i]=n.instantiate(e,i,void 0,t[i])})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return new Di(e,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gt(t,e.unbox),e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Yt(e.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=e.storedValue.get(""+t);if(!n)throw si("Not a child "+t);return n}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object),n=e.name;t.assertWritable({subpath:n});var r=t.type,i=r._subType;switch(e.type){case"update":var o=e.newValue;if(o===e.object.get(n))return null;Gr(i,o),e.newValue=i.reconcile(t.getChildNode(n),e.newValue,t,n),r.processIdentifier(n,e.newValue);break;case"add":Gr(i,e.newValue),e.newValue=i.instantiate(t,n,void 0,e.newValue),r.processIdentifier(n,e.newValue)}return e}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.identifierMode===Ci.YES&&t instanceof Er){var n=t.identifier;if(n!==e)throw si("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+n+"', but expected: '"+e+"'")}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return e.getChildren().forEach((function(e){t[e.subpath]=e.snapshot})),t}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n].getSnapshot()})),t}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=ei(e.object);switch(e.type){case"update":return void t.emitPatch({op:"replace",path:xi(e.name),value:e.newValue.snapshot,oldValue:e.oldValue?e.oldValue.snapshot:void 0},t);case"add":return void t.emitPatch({op:"add",path:xi(e.name),value:e.newValue.snapshot,oldValue:void 0},t);case"delete":var n=e.oldValue.snapshot;return e.oldValue.die(),void t.emitPatch({op:"remove",path:xi(e.name),oldValue:n},t)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=e.storedValue;switch(n.op){case"add":case"replace":r.set(t,n.value);break;case"remove":r.delete(t)}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Gr(this,t);var n=e.storedValue,r={};if(Array.from(n.keys()).forEach((function(e){r[e]=!1})),t)for(var i in t)n.set(i,t[i]),r[""+i]=!0;Object.keys(r).forEach((function(e){!1===r[e]&&n.delete(e)}))}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this;return bi(e)?Hr(Object.keys(e).map((function(r){return n._subType.validate(e[r],Ur(t,r,n._subType))}))):$r(t,e,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ui}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.storedValue.delete(t)}}),t}(kr);Ri.prototype.applySnapshot=Et(Ri.prototype.applySnapshot);var Mi=function(e){function t(t,n,r){void 0===r&&(r=[]);var i=e.call(this,t)||this;return Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Array}),Object.defineProperty(i,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),i.hookInitializers=r,i}return hr(t,e),Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Yr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){void 0===t&&(t=[]);var n=e.type._subType,r={};return t.forEach((function(t,i){var o=""+i;r[o]=n.instantiate(e,o,void 0,t)})),r}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=br(br({},li),{name:this.name});return Ae.array(ii(e),t)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){nr(t).dehancer=e.unbox,e.type.hookInitializers.forEach((function(e){var n=e(t);Object.keys(n).forEach((function(e){var r=n[e],i=Lr(t,e,r);gi(t,e,i)}))})),Kt(t,this.willChange),Qt(t,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=Number(t);if(n=0;n--)t.emitPatch({op:"remove",path:""+(e.index+n),oldValue:e.removed[n].snapshot},t);for(n=0;n0)return n;var r=Jr(e)?ei(e).snapshot:e;return this._predicate(r)?Wr():$r(t,e,this._message(e))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir),ao=function(e){function t(t,n,r){var i=e.call(this,t)||this;return Object.defineProperty(i,"_types",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r=br({eager:!0,dispatcher:void 0},r),i._dispatcher=r.dispatcher,r.eager||(i._eager=!1),i}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){var e=Sr.Union;return this._types.forEach((function(t){e|=t.flags})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._types.some((function(t){return t.isAssignableFrom(e)}))}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map((function(e){return e.describe()})).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(r,void 0);if(!i)throw si("No matching type for union "+this.describe());return i.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this.determineType(t,e.getReconciliationType());if(!i)throw si("No matching type for union "+this.describe());return i.reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._dispatcher?this._dispatcher(e):t?t.is(e)?t:this._types.filter((function(e){return e!==t})).find((function(t){return t.is(e)})):this._types.find((function(t){return t.is(e)}))}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._dispatcher)return this._dispatcher(e).validate(e,t);for(var n=[],r=0,i=0;i=0){var i=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(e,t,n,i)}return this._subtype.instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this._subtype.reconcile(e,this.optionalValues.indexOf(t)<0&&this._subtype.is(t)?t:this.getDefaultInstanceOrSnapshot(),n,r)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="function"==typeof this._defaultValue?this._defaultValue():this._defaultValue;return"function"==typeof this._defaultValue&&Gr(this,e),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.optionalValues.indexOf(e)>=0?Wr():this._subtype.validate(e,t)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._subtype.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t}(Ir);function so(e,t,n){return function(e,t){if("function"!=typeof t&&Jr(t))throw si("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead");Dr()}(0,t),new lo(e,t,n||co)}var co=[void 0],fo=so(eo,void 0),po=so(Qi,null);function ho(e){return Dr(),uo(e,fo)}var bo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return hr(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|Sr.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._subType){var t=void 0;try{t=this._definition()}catch(e){if(!(e instanceof ReferenceError))throw e;t=void 0}if(e&&void 0===t)throw si("Late type seems to be used too early, the definition (still) returns undefined");t&&(this._subType=t)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).instantiate(e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return this.getSubType(!0).reconcile(e,t,n,r)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getSubType(!1);return e?e.name:""}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this.getSubType(!1);return n?n.validate(e,t):Wr()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSubType(!1);return!!t&&t.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.getSubType(!1)||Tr}}),t}(Ir),vo=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Lazy}),Object.defineProperty(r,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(r,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:Ae.array()}),tn((function(){return r.pendingNodeList.length>0&&r.pendingNodeList.some((function(e){return e.isAlive&&r.options.shouldLoadPredicate(e.parent?e.parent.value:null)}))}),(function(){r.options.loadType().then(Et((function(e){r.loadedType=e,r.pendingNodeList.forEach((function(e){e.parent&&r.loadedType&&e.parent.applyPatches([{op:"replace",path:"/"+e.subpath,value:e.snapshot}])}))})))})),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=this;if(this.loadedType)return this.loadedType.instantiate(e,t,n,r);var o=Zr(this,e,t,n,r);return this.pendingNodeList.push(o),tn((function(){return!o.isAlive}),(function(){return i.pendingNodeList.splice(i.pendingNodeList.indexOf(o),1)})),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.loadedType?this.loadedType.validate(e,t):yi(e)?Wr():$r(t,e,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r,i){return this.loadedType?(t.die(),this.loadedType.instantiate(r,i,r.environment,n)):e.prototype.reconcile.call(this,t,n,r,i)}}),t}(Nr),yo=function(e){function t(t){var n=e.call(this,t?"frozen("+t.name+")":"frozen")||this;return Object.defineProperty(n,"subType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Frozen}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return""}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return yi(e)?this.subType?this.subType.validate(e,t):Wr():$r(t,e,"Value is not serializable and cannot be frozen")}}),t}(Nr),go=new yo,_o=function(){function e(e,t){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Io(e))this.identifier=e;else{if(!Jr(e))throw si("Can only store references to tree nodes or identifiers, got: '"+e+"'");var n=ei(e);if(!n.identifierAttribute)throw si("Can only store references with a defined identifier attribute.");var r=n.unnormalizedIdentifier;if(null==r)throw si("Can only store references to tree nodes with a defined identifier.");this.identifier=r}}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Co(this.identifier),n=e.root,r=n.identifierCache.getLastCacheModificationPerId(t);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==r){var i=this.targetType,o=n.identifierCache.resolve(i,t);if(!o)throw new mo("[mobx-state-tree] Failed to resolve reference '"+this.identifier+"' to type '"+this.targetType.name+"' (from node: "+e.path+")");this.resolvedReference={node:o,lastCacheModification:r}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e}(),mo=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return hr(t,e),t}(Error),wo=function(e){function t(t,n){var r=e.call(this,"reference("+t.name+")")||this;return Object.defineProperty(r,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(r,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Reference}),r}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.targetType.isAssignableFrom(e)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Io(e)?Wr():$r(t,e,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=t.parent;if(i&&i.isAlive){var o=i.storedValue;o&&this.onInvalidated({cause:e,parent:o,invalidTarget:r?r.storedValue:void 0,invalidId:n,replaceRef:function(e){_r(t.root.storedValue,{op:"replace",value:e,path:t.path})},removeRef:function(){var e;Vr(e=i.type)&&(e.flags&Sr.Object)>0?this.replaceRef(void 0):_r(t.root.storedValue,{op:"remove",path:t.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var n=this,r=this.getValue(e);if(r){var i=ei(r),o=function(r,o){var a=function(e){switch(e){case fr.beforeDestroy:return"destroy";case fr.beforeDetach:return"detach";default:return}}(o);a&&n.fireInvalidated(a,e,t,i)},a=i.registerHook(fr.beforeDetach,o),u=i.registerHook(fr.beforeDestroy,o);return function(){a(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){var r=this;if(this.onInvalidated){var i;e.registerHook(fr.beforeDestroy,(function(){i&&i()}));var o=function(o){i&&i();var a=e.parent,u=a&&a.storedValue;a&&a.isAlive&&u&&((n?n.get(t,u):e.root.identifierCache.has(r.targetType,Co(t)))?i=r.addTargetNodeWatcher(e,t):o||r.fireInvalidated("invalidSnapshotReference",e,t,null))};e.state===Kr.FINALIZED?o(!0):(e.isRoot||e.root.registerHook(fr.afterCreationFinalization,(function(){e.parent&&e.parent.createObservableInstanceIfNeeded()})),e.registerHook(fr.afterAttach,(function(){o(!1)})))}}}),t}(Nr),Oo=function(e){function t(t,n){return e.call(this,t,n)||this}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return e.storedValue.resolvedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i,o=Jr(r)?(Qr(i=r),ei(i).identifier):r,a=new _o(r,this.targetType),u=Zr(this,e,t,n,a);return a.node=u,this.watchTargetNodeForInvalidations(u,o,void 0),u}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!e.isDetaching&&e.type===this){var i=Jr(t),o=e.storedValue;if(!i&&o.identifier===t||i&&o.resolvedValue===t)return e.setParent(n,r),e}var a=this.instantiate(n,r,void 0,t);return e.die(),a}}),t}(wo),jo=function(e){function t(t,n,r){var i=e.call(this,t,r)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return hr(t,e),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.isAlive)return this.options.get(e.storedValue,e.parent?e.parent.storedValue:null)}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(r)?this.options.set(r,e?e.storedValue:null):r,o=Zr(this,e,t,n,i);return this.watchTargetNodeForInvalidations(o,i,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=Jr(t)?this.options.set(t,e?e.storedValue:null):t;if(!e.isDetaching&&e.type===this&&e.storedValue===i)return e.setParent(n,r),e;var o=this.instantiate(n,r,void 0,i);return e.die(),o}}),t}(wo);function Po(e,t){Dr();var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new jo(e,{get:n.get,set:n.set},r):new Oo(e,r)}var So=function(e){function t(t,n){var r=e.call(this,t)||this;return Object.defineProperty(r,"validType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),r}return hr(t,e),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(!(e&&e.type instanceof Hi))throw si("Identifier types can only be instantiated as direct child of a model type");return Zr(this,e,t,n,r)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){if(e.storedValue!==t)throw si("Tried to change identifier from '"+e.storedValue+"' to '"+t+"'. Changing identifiers is not allowed.");return e.setParent(n,r),e}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return typeof e!==this.validType?$r(t,e,"Value is not a valid "+this.describe()+", expected a "+this.validType):Wr()}}),t}(Nr),Ao=function(e){function t(){var t=e.call(this,"identifier","string")||this;return Object.defineProperty(t,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Identifier}),t}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t}(So),xo=function(e){function t(){return e.call(this,"identifierNumber","number")||this}return hr(t,e),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t}(So),Eo=new Ao,To=new xo;function Co(e){return""+e}function Io(e){return"string"==typeof e||"number"==typeof e}var ko=function(e){function t(t){var n=e.call(this,t.name)||this;return Object.defineProperty(n,"options",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:Sr.Custom}),n}return hr(t,e),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.options.isTargetType(e))return Wr();var n=this.options.getValidationMessage(e);return n?$r(t,e,"Invalid value for type '"+this.name+"': "+n):Wr()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.options.toSnapshot(e.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){return Zr(this,e,t,n,this.options.isTargetType(r)?r:this.options.fromSnapshot(r,e&&e.root.environment))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,r){var i=!this.options.isTargetType(t);if(!e.isDetaching&&e.type===this&&(i?t===e.snapshot:t===e.storedValue))return e.setParent(n,r),e;var o=i?this.options.fromSnapshot(t,n.root.environment):t,a=this.instantiate(n,r,void 0,o);return e.die(),a}}),t}(Nr),No={enumeration:function(e,t){var n="string"==typeof e?t:e,r=uo.apply(void 0,yr(n.map((function(e){return io(""+e)}))));return"string"==typeof e&&(r.name=e),r},model:function(){for(var e=[],t=0;t",e)},array:function(e){return Dr(),new Mi(e.name+"[]",e)},frozen:function(e){return 0===arguments.length?go:Vr(e)?new yo(e):so(go,e)},identifier:Eo,identifierNumber:To,late:function(e,t){var n="string"==typeof e?e:"late("+e.toString()+")";return new bo(n,"string"==typeof e?t:e)},lazy:function(e,t){return new vo(e,t)},undefined:eo,null:Qi,snapshotProcessor:function(e,t,n){return Dr(),new ki(e,t,n)}},Vo=n(215),Do=new(n.n(Vo)().Suite);const Ro={};Do.on("complete",(function(){const e=Do.filter("successful").map((e=>({scenario:e.name,opsSec:e.hz,plusMinus:e.stats.rme,runs:e.stats.sample.length,maxMemory:Ro[e.name]})));console.log(["scenario","ops_per_sec","margin_of_error","runs","max_memory_used_kb"].join(",")),e.forEach((e=>{console.log(e.scenario+","+e.opsSec+","+e.plusMinus+","+e.runs+","+e.maxMemory)}))})),Do.add("Try a reference and succeed",(()=>{void 0!==performance.memory?performance.memory.usedJSHeapSize:process.memoryUsage().heapUsed;const e=No.model("Car",{id:No.identifier}),t=No.model("CarStore",{cars:No.array(e),selectedCar:No.maybe(No.reference(e))}).create({cars:[{id:"47"}],selectedCar:"47"});return function(e,n){void 0===n&&(n=!0);try{var r=t.selectedCar;if(null==r)return;if(Jr(r))return n?(i=r,Qr(),ei(i).observableIsAlive?r:void 0):r;throw si("The reference to be checked is not one of node, null or undefined")}catch(e){if(e instanceof mo)return;throw e}var i}()})),Do.on("cycle",(function(e){console.log(String(e.target))})),Do.run()})(),suite=r})(); \ No newline at end of file diff --git a/build/try-a-reference-and-succeed-web-bundle.js.LICENSE.txt b/build/try-a-reference-and-succeed-web-bundle.js.LICENSE.txt new file mode 100644 index 0000000..084f17d --- /dev/null +++ b/build/try-a-reference-and-succeed-web-bundle.js.LICENSE.txt @@ -0,0 +1,38 @@ +/*! + * Benchmark.js + * Copyright 2010-2016 Mathias Bynens + * Based on JSLitmus.js, copyright Robert Kieffer + * Modified by John-David Dalton + * Available under MIT license + */ + +/*! + * Platform.js v1.3.6 + * Copyright 2014-2020 Benjamin Tan + * Copyright 2011-2013 John-David Dalton + * Available under MIT license + */ + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + +/** + * @license + * Lodash + * 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 + */ diff --git a/package-lock.json b/package-lock.json index 248f1e1..3b9cf9b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,6 +6,7 @@ "": { "dependencies": { "benchmark": "^2.1.4", + "esbuild": "^0.19.5", "lodash": "^4.17.21", "mobx-state-tree": "5.3.0", "puppeteer": "^21.3.8", @@ -55,6 +56,336 @@ "node": ">=10.0.0" } }, + "node_modules/@esbuild/android-arm": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.5.tgz", + "integrity": "sha512-bhvbzWFF3CwMs5tbjf3ObfGqbl/17ict2/uwOSfr3wmxDE6VdS2GqY/FuzIPe0q0bdhj65zQsvqfArI9MY6+AA==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.5.tgz", + "integrity": "sha512-5d1OkoJxnYQfmC+Zd8NBFjkhyCNYwM4n9ODrycTFY6Jk1IGiZ+tjVJDDSwDt77nK+tfpGP4T50iMtVi4dEGzhQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.5.tgz", + "integrity": "sha512-9t+28jHGL7uBdkBjL90QFxe7DVA+KGqWlHCF8ChTKyaKO//VLuoBricQCgwhOjA1/qOczsw843Fy4cbs4H3DVA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.5.tgz", + "integrity": "sha512-mvXGcKqqIqyKoxq26qEDPHJuBYUA5KizJncKOAf9eJQez+L9O+KfvNFu6nl7SCZ/gFb2QPaRqqmG0doSWlgkqw==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.5.tgz", + "integrity": "sha512-Ly8cn6fGLNet19s0X4unjcniX24I0RqjPv+kurpXabZYSXGM4Pwpmf85WHJN3lAgB8GSth7s5A0r856S+4DyiA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.5.tgz", + "integrity": "sha512-GGDNnPWTmWE+DMchq1W8Sd0mUkL+APvJg3b11klSGUDvRXh70JqLAO56tubmq1s2cgpVCSKYywEiKBfju8JztQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.5.tgz", + "integrity": "sha512-1CCwDHnSSoA0HNwdfoNY0jLfJpd7ygaLAp5EHFos3VWJCRX9DMwWODf96s9TSse39Br7oOTLryRVmBoFwXbuuQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.5.tgz", + "integrity": "sha512-lrWXLY/vJBzCPC51QN0HM71uWgIEpGSjSZZADQhq7DKhPcI6NH1IdzjfHkDQws2oNpJKpR13kv7/pFHBbDQDwQ==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.5.tgz", + "integrity": "sha512-o3vYippBmSrjjQUCEEiTZ2l+4yC0pVJD/Dl57WfPwwlvFkrxoSO7rmBZFii6kQB3Wrn/6GwJUPLU5t52eq2meA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.5.tgz", + "integrity": "sha512-MkjHXS03AXAkNp1KKkhSKPOCYztRtK+KXDNkBa6P78F8Bw0ynknCSClO/ztGszILZtyO/lVKpa7MolbBZ6oJtQ==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.5.tgz", + "integrity": "sha512-42GwZMm5oYOD/JHqHska3Jg0r+XFb/fdZRX+WjADm3nLWLcIsN27YKtqxzQmGNJgu0AyXg4HtcSK9HuOk3v1Dw==", + "cpu": [ + "loong64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.5.tgz", + "integrity": "sha512-kcjndCSMitUuPJobWCnwQ9lLjiLZUR3QLQmlgaBfMX23UEa7ZOrtufnRds+6WZtIS9HdTXqND4yH8NLoVVIkcg==", + "cpu": [ + "mips64el" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.5.tgz", + "integrity": "sha512-yJAxJfHVm0ZbsiljbtFFP1BQKLc8kUF6+17tjQ78QjqjAQDnhULWiTA6u0FCDmYT1oOKS9PzZ2z0aBI+Mcyj7Q==", + "cpu": [ + "ppc64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.5.tgz", + "integrity": "sha512-5u8cIR/t3gaD6ad3wNt1MNRstAZO+aNyBxu2We8X31bA8XUNyamTVQwLDA1SLoPCUehNCymhBhK3Qim1433Zag==", + "cpu": [ + "riscv64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.5.tgz", + "integrity": "sha512-Z6JrMyEw/EmZBD/OFEFpb+gao9xJ59ATsoTNlj39jVBbXqoZm4Xntu6wVmGPB/OATi1uk/DB+yeDPv2E8PqZGw==", + "cpu": [ + "s390x" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.5.tgz", + "integrity": "sha512-psagl+2RlK1z8zWZOmVdImisMtrUxvwereIdyJTmtmHahJTKb64pAcqoPlx6CewPdvGvUKe2Jw+0Z/0qhSbG1A==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.5.tgz", + "integrity": "sha512-kL2l+xScnAy/E/3119OggX8SrWyBEcqAh8aOY1gr4gPvw76la2GlD4Ymf832UCVbmuWeTf2adkZDK+h0Z/fB4g==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.5.tgz", + "integrity": "sha512-sPOfhtzFufQfTBgRnE1DIJjzsXukKSvZxloZbkJDG383q0awVAq600pc1nfqBcl0ice/WN9p4qLc39WhBShRTA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.5.tgz", + "integrity": "sha512-dGZkBXaafuKLpDSjKcB0ax0FL36YXCvJNnztjKV+6CO82tTYVDSH2lifitJ29jxRMoUhgkg9a+VA/B03WK5lcg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.5.tgz", + "integrity": "sha512-dWVjD9y03ilhdRQ6Xig1NWNgfLtf2o/STKTS+eZuF90fI2BhbwD6WlaiCGKptlqXlURVB5AUOxUj09LuwKGDTg==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.5.tgz", + "integrity": "sha512-4liggWIA4oDgUxqpZwrDhmEfAH4d0iljanDOK7AnVU89T6CzHon/ony8C5LeOdfgx60x5cnQJFZwEydVlYx4iw==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.5.tgz", + "integrity": "sha512-czTrygUsB/jlM8qEW5MD8bgYU2Xg14lo6kBDXW6HdxKjh8M5PzETGiSHaz9MtbXBYDloHNUAUW2tMiKW4KM9Mw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", @@ -803,6 +1134,42 @@ "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.3.1.tgz", "integrity": "sha512-JUFAyicQV9mXc3YRxPnDlrfBKpqt6hUYzz9/boprUJHs4e4KVr3XwOF70doO6gwXUor6EWZJAyWAfKki84t20Q==" }, + "node_modules/esbuild": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.5.tgz", + "integrity": "sha512-bUxalY7b1g8vNhQKdB24QDmHeY4V4tw/s6Ak5z+jJX9laP5MoQseTOMemAr0gxssjNcH0MCViG8ONI2kksvfFQ==", + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/android-arm": "0.19.5", + "@esbuild/android-arm64": "0.19.5", + "@esbuild/android-x64": "0.19.5", + "@esbuild/darwin-arm64": "0.19.5", + "@esbuild/darwin-x64": "0.19.5", + "@esbuild/freebsd-arm64": "0.19.5", + "@esbuild/freebsd-x64": "0.19.5", + "@esbuild/linux-arm": "0.19.5", + "@esbuild/linux-arm64": "0.19.5", + "@esbuild/linux-ia32": "0.19.5", + "@esbuild/linux-loong64": "0.19.5", + "@esbuild/linux-mips64el": "0.19.5", + "@esbuild/linux-ppc64": "0.19.5", + "@esbuild/linux-riscv64": "0.19.5", + "@esbuild/linux-s390x": "0.19.5", + "@esbuild/linux-x64": "0.19.5", + "@esbuild/netbsd-x64": "0.19.5", + "@esbuild/openbsd-x64": "0.19.5", + "@esbuild/sunos-x64": "0.19.5", + "@esbuild/win32-arm64": "0.19.5", + "@esbuild/win32-ia32": "0.19.5", + "@esbuild/win32-x64": "0.19.5" + } + }, "node_modules/escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", @@ -2349,6 +2716,138 @@ "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz", "integrity": "sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==" }, + "@esbuild/android-arm": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.5.tgz", + "integrity": "sha512-bhvbzWFF3CwMs5tbjf3ObfGqbl/17ict2/uwOSfr3wmxDE6VdS2GqY/FuzIPe0q0bdhj65zQsvqfArI9MY6+AA==", + "optional": true + }, + "@esbuild/android-arm64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.5.tgz", + "integrity": "sha512-5d1OkoJxnYQfmC+Zd8NBFjkhyCNYwM4n9ODrycTFY6Jk1IGiZ+tjVJDDSwDt77nK+tfpGP4T50iMtVi4dEGzhQ==", + "optional": true + }, + "@esbuild/android-x64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.5.tgz", + "integrity": "sha512-9t+28jHGL7uBdkBjL90QFxe7DVA+KGqWlHCF8ChTKyaKO//VLuoBricQCgwhOjA1/qOczsw843Fy4cbs4H3DVA==", + "optional": true + }, + "@esbuild/darwin-arm64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.5.tgz", + "integrity": "sha512-mvXGcKqqIqyKoxq26qEDPHJuBYUA5KizJncKOAf9eJQez+L9O+KfvNFu6nl7SCZ/gFb2QPaRqqmG0doSWlgkqw==", + "optional": true + }, + "@esbuild/darwin-x64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.5.tgz", + "integrity": "sha512-Ly8cn6fGLNet19s0X4unjcniX24I0RqjPv+kurpXabZYSXGM4Pwpmf85WHJN3lAgB8GSth7s5A0r856S+4DyiA==", + "optional": true + }, + "@esbuild/freebsd-arm64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.5.tgz", + "integrity": "sha512-GGDNnPWTmWE+DMchq1W8Sd0mUkL+APvJg3b11klSGUDvRXh70JqLAO56tubmq1s2cgpVCSKYywEiKBfju8JztQ==", + "optional": true + }, + "@esbuild/freebsd-x64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.5.tgz", + "integrity": "sha512-1CCwDHnSSoA0HNwdfoNY0jLfJpd7ygaLAp5EHFos3VWJCRX9DMwWODf96s9TSse39Br7oOTLryRVmBoFwXbuuQ==", + "optional": true + }, + "@esbuild/linux-arm": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.5.tgz", + "integrity": "sha512-lrWXLY/vJBzCPC51QN0HM71uWgIEpGSjSZZADQhq7DKhPcI6NH1IdzjfHkDQws2oNpJKpR13kv7/pFHBbDQDwQ==", + "optional": true + }, + "@esbuild/linux-arm64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.5.tgz", + "integrity": "sha512-o3vYippBmSrjjQUCEEiTZ2l+4yC0pVJD/Dl57WfPwwlvFkrxoSO7rmBZFii6kQB3Wrn/6GwJUPLU5t52eq2meA==", + "optional": true + }, + "@esbuild/linux-ia32": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.5.tgz", + "integrity": "sha512-MkjHXS03AXAkNp1KKkhSKPOCYztRtK+KXDNkBa6P78F8Bw0ynknCSClO/ztGszILZtyO/lVKpa7MolbBZ6oJtQ==", + "optional": true + }, + "@esbuild/linux-loong64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.5.tgz", + "integrity": "sha512-42GwZMm5oYOD/JHqHska3Jg0r+XFb/fdZRX+WjADm3nLWLcIsN27YKtqxzQmGNJgu0AyXg4HtcSK9HuOk3v1Dw==", + "optional": true + }, + "@esbuild/linux-mips64el": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.5.tgz", + "integrity": "sha512-kcjndCSMitUuPJobWCnwQ9lLjiLZUR3QLQmlgaBfMX23UEa7ZOrtufnRds+6WZtIS9HdTXqND4yH8NLoVVIkcg==", + "optional": true + }, + "@esbuild/linux-ppc64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.5.tgz", + "integrity": "sha512-yJAxJfHVm0ZbsiljbtFFP1BQKLc8kUF6+17tjQ78QjqjAQDnhULWiTA6u0FCDmYT1oOKS9PzZ2z0aBI+Mcyj7Q==", + "optional": true + }, + "@esbuild/linux-riscv64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.5.tgz", + "integrity": "sha512-5u8cIR/t3gaD6ad3wNt1MNRstAZO+aNyBxu2We8X31bA8XUNyamTVQwLDA1SLoPCUehNCymhBhK3Qim1433Zag==", + "optional": true + }, + "@esbuild/linux-s390x": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.5.tgz", + "integrity": "sha512-Z6JrMyEw/EmZBD/OFEFpb+gao9xJ59ATsoTNlj39jVBbXqoZm4Xntu6wVmGPB/OATi1uk/DB+yeDPv2E8PqZGw==", + "optional": true + }, + "@esbuild/linux-x64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.5.tgz", + "integrity": "sha512-psagl+2RlK1z8zWZOmVdImisMtrUxvwereIdyJTmtmHahJTKb64pAcqoPlx6CewPdvGvUKe2Jw+0Z/0qhSbG1A==", + "optional": true + }, + "@esbuild/netbsd-x64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.5.tgz", + "integrity": "sha512-kL2l+xScnAy/E/3119OggX8SrWyBEcqAh8aOY1gr4gPvw76la2GlD4Ymf832UCVbmuWeTf2adkZDK+h0Z/fB4g==", + "optional": true + }, + "@esbuild/openbsd-x64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.5.tgz", + "integrity": "sha512-sPOfhtzFufQfTBgRnE1DIJjzsXukKSvZxloZbkJDG383q0awVAq600pc1nfqBcl0ice/WN9p4qLc39WhBShRTA==", + "optional": true + }, + "@esbuild/sunos-x64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.5.tgz", + "integrity": "sha512-dGZkBXaafuKLpDSjKcB0ax0FL36YXCvJNnztjKV+6CO82tTYVDSH2lifitJ29jxRMoUhgkg9a+VA/B03WK5lcg==", + "optional": true + }, + "@esbuild/win32-arm64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.5.tgz", + "integrity": "sha512-dWVjD9y03ilhdRQ6Xig1NWNgfLtf2o/STKTS+eZuF90fI2BhbwD6WlaiCGKptlqXlURVB5AUOxUj09LuwKGDTg==", + "optional": true + }, + "@esbuild/win32-ia32": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.5.tgz", + "integrity": "sha512-4liggWIA4oDgUxqpZwrDhmEfAH4d0iljanDOK7AnVU89T6CzHon/ony8C5LeOdfgx60x5cnQJFZwEydVlYx4iw==", + "optional": true + }, + "@esbuild/win32-x64": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.5.tgz", + "integrity": "sha512-czTrygUsB/jlM8qEW5MD8bgYU2Xg14lo6kBDXW6HdxKjh8M5PzETGiSHaz9MtbXBYDloHNUAUW2tMiKW4KM9Mw==", + "optional": true + }, "@jridgewell/gen-mapping": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", @@ -2907,6 +3406,35 @@ "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.3.1.tgz", "integrity": "sha512-JUFAyicQV9mXc3YRxPnDlrfBKpqt6hUYzz9/boprUJHs4e4KVr3XwOF70doO6gwXUor6EWZJAyWAfKki84t20Q==" }, + "esbuild": { + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.5.tgz", + "integrity": "sha512-bUxalY7b1g8vNhQKdB24QDmHeY4V4tw/s6Ak5z+jJX9laP5MoQseTOMemAr0gxssjNcH0MCViG8ONI2kksvfFQ==", + "requires": { + "@esbuild/android-arm": "0.19.5", + "@esbuild/android-arm64": "0.19.5", + "@esbuild/android-x64": "0.19.5", + "@esbuild/darwin-arm64": "0.19.5", + "@esbuild/darwin-x64": "0.19.5", + "@esbuild/freebsd-arm64": "0.19.5", + "@esbuild/freebsd-x64": "0.19.5", + "@esbuild/linux-arm": "0.19.5", + "@esbuild/linux-arm64": "0.19.5", + "@esbuild/linux-ia32": "0.19.5", + "@esbuild/linux-loong64": "0.19.5", + "@esbuild/linux-mips64el": "0.19.5", + "@esbuild/linux-ppc64": "0.19.5", + "@esbuild/linux-riscv64": "0.19.5", + "@esbuild/linux-s390x": "0.19.5", + "@esbuild/linux-x64": "0.19.5", + "@esbuild/netbsd-x64": "0.19.5", + "@esbuild/openbsd-x64": "0.19.5", + "@esbuild/sunos-x64": "0.19.5", + "@esbuild/win32-arm64": "0.19.5", + "@esbuild/win32-ia32": "0.19.5", + "@esbuild/win32-x64": "0.19.5" + } + }, "escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", diff --git a/package.json b/package.json index 9bab122..84a437b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "type": "module", "dependencies": { "benchmark": "^2.1.4", + "esbuild": "^0.19.5", "lodash": "^4.17.21", "mobx-state-tree": "5.3.0", "puppeteer": "^21.3.8", diff --git a/puppeteer.cjs b/puppeteer.cjs index d6b833b..d83aecd 100644 --- a/puppeteer.cjs +++ b/puppeteer.cjs @@ -2,9 +2,16 @@ const puppeteer = require("puppeteer"); const fs = require("fs").promises; (async () => { + // Check if the bundle file path is provided as a command line argument + const bundleFilePath = process.argv[2]; + if (!bundleFilePath) { + console.error("Error: Please provide a path to the web bundle file."); + process.exit(1); + } + // Launch a headless browser const browser = await puppeteer.launch({ - headless: "new", + headless: true, args: ["--enable-precise-memory-info"], }); @@ -19,10 +26,7 @@ const fs = require("fs").promises; // Read the contents of the local JavaScript files const lodashScript = await fs.readFile("./vendor/lodash.js", "utf-8"); const benchmarkScript = await fs.readFile("./vendor/benchmark.js", "utf-8"); - const indexBundleScript = await fs.readFile( - "./build/index.web.bundle.js", - "utf-8" - ); + const indexBundleScript = await fs.readFile(bundleFilePath, "utf-8"); // HTML content with inlined JavaScript const htmlContent = ` diff --git a/runner.js b/runner.js index a8bfced..f6e3673 100644 --- a/runner.js +++ b/runner.js @@ -64,11 +64,11 @@ suite.on("complete", function () { }); console.log(headers.join(",")); - results.forEach((result) => + results.forEach((result) => { console.log( `${result.scenario},${result.opsSec},${result.plusMinus},${result.runs},${result.maxMemory}` - ) - ); + ); + }); }); for (const scenario in Scenarios) { @@ -82,4 +82,8 @@ for (const scenario in Scenarios) { }); } +suite.on("cycle", function (event) { + console.log(String(event.target)); +}); + suite.run(); diff --git a/scenarios/array-operations.js b/scenarios/add-1-object-to-array.perf.md similarity index 70% rename from scenarios/array-operations.js rename to scenarios/add-1-object-to-array.perf.md index 7b2fef4..bf350f1 100644 --- a/scenarios/array-operations.js +++ b/scenarios/add-1-object-to-array.perf.md @@ -1,5 +1,12 @@ +--- +title: "Add 1 object to an array" +--- + +```js import { types } from "mobx-state-tree"; +``` +```js const SampleModel = types.model({ name: types.string, id: types.string, @@ -18,9 +25,6 @@ const SampleStore = types /** * Requested by the community in https://github.com/coolsoftwaretyler/mst-performance-testing/issues/26 */ -export const addNObjectsToArray = (n) => { - const store = SampleStore.create({ items: [] }); - for (let i = 0; i < n; i++) { - store.add(`item-${i}`, `id-${i}`); - } -}; +const store = SampleStore.create({ items: [] }); +store.add(`item-1`, `id-1`); +``` diff --git a/scenarios/add-10-objects-to-array.perf.md b/scenarios/add-10-objects-to-array.perf.md new file mode 100644 index 0000000..cac1c51 --- /dev/null +++ b/scenarios/add-10-objects-to-array.perf.md @@ -0,0 +1,32 @@ +--- +title: "Add 10 objects to an array" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +const SampleModel = types.model({ + name: types.string, + id: types.string, +}); + +const SampleStore = types + .model({ + items: types.array(SampleModel), + }) + .actions((self) => ({ + add(name, id) { + self.items.push({ name, id }); + }, + })); + +/** + * Requested by the community in https://github.com/coolsoftwaretyler/mst-performance-testing/issues/26 + */ +const store = SampleStore.create({ items: [] }); +for (let i = 0; i < 10; i++) { + store.add(`item-${i}`, `id-${i}`); +} +``` diff --git a/scenarios/add-100-objects-to-array.perf.md b/scenarios/add-100-objects-to-array.perf.md new file mode 100644 index 0000000..e475aa1 --- /dev/null +++ b/scenarios/add-100-objects-to-array.perf.md @@ -0,0 +1,32 @@ +--- +title: "Add 100 objects to an array" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +const SampleModel = types.model({ + name: types.string, + id: types.string, +}); + +const SampleStore = types + .model({ + items: types.array(SampleModel), + }) + .actions((self) => ({ + add(name, id) { + self.items.push({ name, id }); + }, + })); + +/** + * Requested by the community in https://github.com/coolsoftwaretyler/mst-performance-testing/issues/26 + */ +const store = SampleStore.create({ items: [] }); +for (let i = 0; i < 100; i++) { + store.add(`item-${i}`, `id-${i}`); +} +``` diff --git a/scenarios/add-1000-objects-to-array.perf.md b/scenarios/add-1000-objects-to-array.perf.md new file mode 100644 index 0000000..bbbadb7 --- /dev/null +++ b/scenarios/add-1000-objects-to-array.perf.md @@ -0,0 +1,32 @@ +--- +title: "Add 1000 objects to an array" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +const SampleModel = types.model({ + name: types.string, + id: types.string, +}); + +const SampleStore = types + .model({ + items: types.array(SampleModel), + }) + .actions((self) => ({ + add(name, id) { + self.items.push({ name, id }); + }, + })); + +/** + * Requested by the community in https://github.com/coolsoftwaretyler/mst-performance-testing/issues/26 + */ +const store = SampleStore.create({ items: [] }); +for (let i = 0; i < 1000; i++) { + store.add(`item-${i}`, `id-${i}`); +} +``` diff --git a/scenarios/add-10000-object-to-array.perf.md b/scenarios/add-10000-object-to-array.perf.md new file mode 100644 index 0000000..adea0b5 --- /dev/null +++ b/scenarios/add-10000-object-to-array.perf.md @@ -0,0 +1,32 @@ +--- +title: "Add 10000 objects to an array" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +const SampleModel = types.model({ + name: types.string, + id: types.string, +}); + +const SampleStore = types + .model({ + items: types.array(SampleModel), + }) + .actions((self) => ({ + add(name, id) { + self.items.push({ name, id }); + }, + })); + +/** + * Requested by the community in https://github.com/coolsoftwaretyler/mst-performance-testing/issues/26 + */ +const store = SampleStore.create({ items: [] }); +for (let i = 0; i < 10000; i++) { + store.add(`item-${i}`, `id-${i}`); +} +``` diff --git a/scenarios/add-100000-object-to-array.perf.md b/scenarios/add-100000-object-to-array.perf.md new file mode 100644 index 0000000..7ffa20b --- /dev/null +++ b/scenarios/add-100000-object-to-array.perf.md @@ -0,0 +1,32 @@ +--- +title: "Add 100000 objects to an array" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +const SampleModel = types.model({ + name: types.string, + id: types.string, +}); + +const SampleStore = types + .model({ + items: types.array(SampleModel), + }) + .actions((self) => ({ + add(name, id) { + self.items.push({ name, id }); + }, + })); + +/** + * Requested by the community in https://github.com/coolsoftwaretyler/mst-performance-testing/issues/26 + */ +const store = SampleStore.create({ items: [] }); +for (let i = 0; i < 100000; i++) { + store.add(`item-${i}`, `id-${i}`); +} +``` diff --git a/scenarios/add-middleware-and-use-it.perf.md b/scenarios/add-middleware-and-use-it.perf.md new file mode 100644 index 0000000..4e35947 --- /dev/null +++ b/scenarios/add-middleware-and-use-it.perf.md @@ -0,0 +1,31 @@ +--- +title: "Add middleware and use it" +--- + +```js +import { addMiddleware, types } from "mobx-state-tree"; +``` + +```js +const Todo = types.model({ + task: types.string, +}); + +const TodoStore = types + .model({ + todos: types.array(Todo), + }) + .actions((self) => ({ + add(todo) { + self.todos.push(todo); + }, + })); + +const s = TodoStore.create({ todos: [] }); + +addMiddleware(s, (call, next) => { + next(call); +}); + +s.add({ task: "string" }); +``` diff --git a/scenarios/add-middleware-to-action-with-hooks.perf.md b/scenarios/add-middleware-to-action-with-hooks.perf.md new file mode 100644 index 0000000..0d4a922 --- /dev/null +++ b/scenarios/add-middleware-to-action-with-hooks.perf.md @@ -0,0 +1,27 @@ +--- +title: "Add middleware to an action and include hooks (default)" +--- + +```js +import { addMiddleware, types } from "mobx-state-tree"; +``` + +```js +const Todo = types.model({ + task: types.string, +}); + +const TodoStore = types + .model({ + todos: types.array(Todo), + }) + .actions((self) => ({ + add(todo) { + self.todos.push(todo); + }, + })); + +const s = TodoStore.create({ todos: [] }); + +addMiddleware(s, () => {}); +``` diff --git a/scenarios/add-middleware-to-action-without-hooks.perf.md b/scenarios/add-middleware-to-action-without-hooks.perf.md new file mode 100644 index 0000000..ff650bc --- /dev/null +++ b/scenarios/add-middleware-to-action-without-hooks.perf.md @@ -0,0 +1,27 @@ +--- +title: "Add middleware to an action without hooks" +--- + +```js +import { addMiddleware, types } from "mobx-state-tree"; +``` + +```js +const Todo = types.model({ + task: types.string, +}); + +const TodoStore = types + .model({ + todos: types.array(Todo), + }) + .actions((self) => ({ + add(todo) { + self.todos.push(todo); + }, + })); + +const s = TodoStore.create({ todos: [] }); + +addMiddleware(s, () => {}, false); +``` diff --git a/scenarios/add-patch-listener-to-model.perf.md b/scenarios/add-patch-listener-to-model.perf.md new file mode 100644 index 0000000..c8cfaa6 --- /dev/null +++ b/scenarios/add-patch-listener-to-model.perf.md @@ -0,0 +1,31 @@ +--- +title: "Add a patch listener to a model" +--- + +```js +import { types, onPatch } from "mobx-state-tree"; +``` + +```js +const Model = types.model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, +}); + +const m = Model.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), +}); + +onPatch(m, (patch) => { + return patch; +}); +``` diff --git a/scenarios/apply-patch-to-model-with-simple-patch-listener.perf.md b/scenarios/apply-patch-to-model-with-simple-patch-listener.perf.md new file mode 100644 index 0000000..5203726 --- /dev/null +++ b/scenarios/apply-patch-to-model-with-simple-patch-listener.perf.md @@ -0,0 +1,33 @@ +--- +title: "Apply patch to model with simple patch listener" +--- + +```js +import { types, onPatch, applyPatch } from "mobx-state-tree"; +``` + +```js +const Model = types.model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, +}); + +const m = Model.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), +}); + +applyPatch(m, { + op: "replace", + path: "/string", + value: "new string", +}); +``` diff --git a/scenarios/apply-snapshot-to-model-with-listener.perf.md b/scenarios/apply-snapshot-to-model-with-listener.perf.md new file mode 100644 index 0000000..ce61a4b --- /dev/null +++ b/scenarios/apply-snapshot-to-model-with-listener.perf.md @@ -0,0 +1,34 @@ +--- +title: "Apply a snapshot to a model with a snapshot listener" +--- + +```js +import { types, getSnapshot, applySnapshot, onSnapshot } from "mobx-state-tree"; +``` + +```js +const Model = types.model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, +}); + +const m = Model.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), +}); + +onSnapshot(m, (snapshot) => { + return snapshot; +}); + +const snapshot = getSnapshot(m); +applySnapshot(m, snapshot); +``` diff --git a/scenarios/apply-snapshot-to-model.perf.md b/scenarios/apply-snapshot-to-model.perf.md new file mode 100644 index 0000000..33b299a --- /dev/null +++ b/scenarios/apply-snapshot-to-model.perf.md @@ -0,0 +1,30 @@ +--- +title: "Apply a snapshot to a model" +--- + +```js +import { types, getSnapshot, applySnapshot } from "mobx-state-tree"; +``` + +```js +const Model = types.model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, +}); + +const m = Model.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), +}); + +const snapshot = getSnapshot(m); +applySnapshot(m, snapshot); +``` diff --git a/scenarios/check-invalid-model-mst.perf.md b/scenarios/check-invalid-model-mst.perf.md new file mode 100644 index 0000000..c1807f5 --- /dev/null +++ b/scenarios/check-invalid-model-mst.perf.md @@ -0,0 +1,55 @@ +--- +title: "Check an invalid model with MST typecheck" +--- + +```js +import { types, typecheck } from "mobx-state-tree"; +``` + +```js +const ExampleModelMST = types.model({ + id: types.identifier, + name: types.string, + age: types.number, + isHappy: types.boolean, + createdAt: types.Date, + updatedAt: types.maybeNull(types.Date), + favoriteColors: types.array(types.string), + favoriteNumbers: types.array(types.number), + favoriteFoods: types.array( + types.model({ + name: types.string, + calories: types.number, + }) + ), +}); + +const FalseExampleModelMST = types.model({ + id: types.identifier, + shouldMatch: false, +}); + +const model = ExampleModelMST.create({ + id: "1", + name: "John", + age: 42, + isHappy: true, + createdAt: new Date(), + updatedAt: null, + favoriteColors: ["blue", "green"], + favoriteNumbers: [1, 2, 3], + favoriteFoods: [ + { + name: "Pizza", + calories: 1000, + }, + ], +}); + +// We expect an error here from MST, so just catch it and keep going. +try { + typecheck(FalseExampleModelMST, model); +} catch (e) { + return; +} +``` diff --git a/scenarios/check-invalid-model-zod.perf.md b/scenarios/check-invalid-model-zod.perf.md new file mode 100644 index 0000000..fa556c5 --- /dev/null +++ b/scenarios/check-invalid-model-zod.perf.md @@ -0,0 +1,38 @@ +--- +title: "Check an invalid model with Zod typecheck" +--- + +```js +import { z } from "zod"; +``` + +```js +const ExampleSchemaZod = z.object({ + id: z.number(), + name: z.string(), + age: z.number(), + isHappy: z.boolean(), + createdAt: z.date(), + updatedAt: z.date().nullable(), + favoriteColors: z.array(z.string()), + favoriteNumbers: z.array(z.number()), + favoriteFoods: z.array( + z.object({ + name: z.string(), + calories: z.number(), + }) + ), +}); + +const schemaFail = { + id: 1, + name: "John", +}; + +// We expect an error here from Zod, so just catch it and keep going. +try { + ExampleSchemaZod.parse(schemaFail); +} catch (e) { + return; +} +``` diff --git a/scenarios/check-invalid-snapshot-mst.perf.md b/scenarios/check-invalid-snapshot-mst.perf.md new file mode 100644 index 0000000..20ae8ea --- /dev/null +++ b/scenarios/check-invalid-snapshot-mst.perf.md @@ -0,0 +1,52 @@ +--- +title: "Check an invalid snapshot with MST typecheck" +--- + +```js +import { types, typecheck } from "mobx-state-tree"; +``` + +```js +const ExampleModelMST = types.model({ + id: types.identifier, + name: types.string, + age: types.number, + isHappy: types.boolean, + createdAt: types.Date, + updatedAt: types.maybeNull(types.Date), + favoriteColors: types.array(types.string), + favoriteNumbers: types.array(types.number), + favoriteFoods: types.array( + types.model({ + name: types.string, + calories: types.number, + }) + ), +}); + +const FalseExampleModelMST = types.model({ + id: types.identifier, + shouldMatch: false, +}); + +try { + typecheck(FalseExampleModelMST, { + id: "1", + name: "John", + age: 42, + isHappy: true, + createdAt: new Date(), + updatedAt: null, + favoriteColors: ["blue", "green"], + favoriteNumbers: [1, 2, 3], + favoriteFoods: [ + { + name: "Pizza", + calories: 1000, + }, + ], + }); +} catch (e) { + return; +} +``` diff --git a/scenarios/check-reference-and-fail.perf.md b/scenarios/check-reference-and-fail.perf.md new file mode 100644 index 0000000..18c3499 --- /dev/null +++ b/scenarios/check-reference-and-fail.perf.md @@ -0,0 +1,37 @@ +--- +title: "Check a reference and fail" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +const Car = types.model("Car", { + id: types.identifier, +}); + +const CarStore = types.model("CarStore", { + cars: types.array(Car), + selectedCar: types.reference(Car), +}); + +// create a store with a normalized snapshot +const store = CarStore.create({ + cars: [ + { + id: "47", + }, + ], + selectedCar: "47", +}); + +applySnapshot(store, { + ...store, + selectedCar: "48", +}); + +const isValid = isValidReference(() => store.selectedCar); + +return isValid; +``` diff --git a/scenarios/check-reference-and-succeed.perf.md b/scenarios/check-reference-and-succeed.perf.md new file mode 100644 index 0000000..8b563b9 --- /dev/null +++ b/scenarios/check-reference-and-succeed.perf.md @@ -0,0 +1,32 @@ +--- +title: "Check a reference and succeed" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +const Car = types.model("Car", { + id: types.identifier, +}); + +const CarStore = types.model("CarStore", { + cars: types.array(Car), + selectedCar: types.reference(Car), +}); + +// create a store with a normalized snapshot +const store = CarStore.create({ + cars: [ + { + id: "47", + }, + ], + selectedCar: "47", +}); + +const isValid = isValidReference(() => store.selectedCar); + +return isValid; +``` diff --git a/scenarios/check-valid-model-mst.perf.md b/scenarios/check-valid-model-mst.perf.md new file mode 100644 index 0000000..99bb94c --- /dev/null +++ b/scenarios/check-valid-model-mst.perf.md @@ -0,0 +1,45 @@ +--- +title: "Check a valid model with MST typecheck" +--- + +```js +import { types, typecheck } from "mobx-state-tree"; +``` + +```js +const ExampleModelMST = types.model({ + id: types.identifier, + name: types.string, + age: types.number, + isHappy: types.boolean, + createdAt: types.Date, + updatedAt: types.maybeNull(types.Date), + favoriteColors: types.array(types.string), + favoriteNumbers: types.array(types.number), + favoriteFoods: types.array( + types.model({ + name: types.string, + calories: types.number, + }) + ), +}); + +const model = ExampleModelMST.create({ + id: "1", + name: "John", + age: 42, + isHappy: true, + createdAt: new Date(), + updatedAt: null, + favoriteColors: ["blue", "green"], + favoriteNumbers: [1, 2, 3], + favoriteFoods: [ + { + name: "Pizza", + calories: 1000, + }, + ], +}); + +typecheck(ExampleModelMST, model); +``` diff --git a/scenarios/check-valid-model-zod.perf.md b/scenarios/check-valid-model-zod.perf.md new file mode 100644 index 0000000..c272890 --- /dev/null +++ b/scenarios/check-valid-model-zod.perf.md @@ -0,0 +1,45 @@ +--- +title: "Check a valid model with Zod typecheck" +--- + +```js +import { z } from "zod"; +``` + +```js +const ExampleSchemaZod = z.object({ + id: z.number(), + name: z.string(), + age: z.number(), + isHappy: z.boolean(), + createdAt: z.date(), + updatedAt: z.date().nullable(), + favoriteColors: z.array(z.string()), + favoriteNumbers: z.array(z.number()), + favoriteFoods: z.array( + z.object({ + name: z.string(), + calories: z.number(), + }) + ), +}); + +const schemaSuccess = { + id: 1, + name: "John", + age: 42, + isHappy: true, + createdAt: new Date(), + updatedAt: null, + favoriteColors: ["blue", "green"], + favoriteNumbers: [1, 2, 3], + favoriteFoods: [ + { + name: "Pizza", + calories: 1000, + }, + ], +}; + +ExampleSchemaZod.parse(schemaSuccess); +``` diff --git a/scenarios/check-valid-snapshot-mst.perf.md b/scenarios/check-valid-snapshot-mst.perf.md new file mode 100644 index 0000000..b4523cf --- /dev/null +++ b/scenarios/check-valid-snapshot-mst.perf.md @@ -0,0 +1,43 @@ +--- +title: "Check a valid snapshot with MST typecheck" +--- + +```js +import { types, typecheck } from "mobx-state-tree"; +``` + +```js +const ExampleModelMST = types.model({ + id: types.identifier, + name: types.string, + age: types.number, + isHappy: types.boolean, + createdAt: types.Date, + updatedAt: types.maybeNull(types.Date), + favoriteColors: types.array(types.string), + favoriteNumbers: types.array(types.number), + favoriteFoods: types.array( + types.model({ + name: types.string, + calories: types.number, + }) + ), +}); + +typecheck(ExampleModelMST, { + id: "1", + name: "John", + age: 42, + isHappy: true, + createdAt: new Date(), + updatedAt: null, + favoriteColors: ["blue", "green"], + favoriteNumbers: [1, 2, 3], + favoriteFoods: [ + { + name: "Pizza", + calories: 1000, + }, + ], +}); +``` diff --git a/scenarios/model-creation.js b/scenarios/create-1-model.perf.md similarity index 66% rename from scenarios/model-creation.js rename to scenarios/create-1-model.perf.md index 2b56997..07b3391 100644 --- a/scenarios/model-creation.js +++ b/scenarios/create-1-model.perf.md @@ -1,6 +1,13 @@ +--- +title: "Create 1 model" +--- + +```js import { types } from "mobx-state-tree"; +``` -export const ModelWithPrimitivesAndActions = types +```js +const ModelWithPrimitivesAndActions = types .model({ string: types.string, number: types.number, @@ -30,15 +37,12 @@ export const ModelWithPrimitivesAndActions = types }, })); -export const createNModels = (n) => { - for (let i = 0; i < n; i++) { - ModelWithPrimitivesAndActions.create({ - string: "string", - number: 1, - integer: 1, - float: 1.1, - boolean: true, - date: new Date(), - }); - } -}; +ModelWithPrimitivesAndActions.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), +}); +``` diff --git a/scenarios/create-10-models.perf.md b/scenarios/create-10-models.perf.md new file mode 100644 index 0000000..9350b61 --- /dev/null +++ b/scenarios/create-10-models.perf.md @@ -0,0 +1,50 @@ +--- +title: "Create 10 models" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +const ModelWithPrimitivesAndActions = types + .model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, + }) + .actions((self) => ({ + setString(string) { + self.string = string; + }, + setNumber(number) { + self.number = number; + }, + setInteger(integer) { + self.integer = integer; + }, + setFloat(float) { + self.float = float; + }, + setBoolean(boolean) { + self.boolean = boolean; + }, + setDate(date) { + self.date = date; + }, + })); + +for (let i = 0; i < 10; i++) { + ModelWithPrimitivesAndActions.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), + }); +} +``` diff --git a/scenarios/create-100-models.perf.md b/scenarios/create-100-models.perf.md new file mode 100644 index 0000000..c718261 --- /dev/null +++ b/scenarios/create-100-models.perf.md @@ -0,0 +1,50 @@ +--- +title: "Create 100 models" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +const ModelWithPrimitivesAndActions = types + .model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, + }) + .actions((self) => ({ + setString(string) { + self.string = string; + }, + setNumber(number) { + self.number = number; + }, + setInteger(integer) { + self.integer = integer; + }, + setFloat(float) { + self.float = float; + }, + setBoolean(boolean) { + self.boolean = boolean; + }, + setDate(date) { + self.date = date; + }, + })); + +for (let i = 0; i < 100; i++) { + ModelWithPrimitivesAndActions.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), + }); +} +``` diff --git a/scenarios/create-1000-models.perf.md b/scenarios/create-1000-models.perf.md new file mode 100644 index 0000000..528dec3 --- /dev/null +++ b/scenarios/create-1000-models.perf.md @@ -0,0 +1,50 @@ +--- +title: "Create 1000 models" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +const ModelWithPrimitivesAndActions = types + .model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, + }) + .actions((self) => ({ + setString(string) { + self.string = string; + }, + setNumber(number) { + self.number = number; + }, + setInteger(integer) { + self.integer = integer; + }, + setFloat(float) { + self.float = float; + }, + setBoolean(boolean) { + self.boolean = boolean; + }, + setDate(date) { + self.date = date; + }, + })); + +for (let i = 0; i < 1000; i++) { + ModelWithPrimitivesAndActions.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), + }); +} +``` diff --git a/scenarios/create-10000-models.perf.md b/scenarios/create-10000-models.perf.md new file mode 100644 index 0000000..3ed57e1 --- /dev/null +++ b/scenarios/create-10000-models.perf.md @@ -0,0 +1,50 @@ +--- +title: "Create 10000 models" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +const ModelWithPrimitivesAndActions = types + .model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, + }) + .actions((self) => ({ + setString(string) { + self.string = string; + }, + setNumber(number) { + self.number = number; + }, + setInteger(integer) { + self.integer = integer; + }, + setFloat(float) { + self.float = float; + }, + setBoolean(boolean) { + self.boolean = boolean; + }, + setDate(date) { + self.date = date; + }, + })); + +for (let i = 0; i < 10000; i++) { + ModelWithPrimitivesAndActions.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), + }); +} +``` diff --git a/scenarios/create-100000-models.perf.md b/scenarios/create-100000-models.perf.md new file mode 100644 index 0000000..66f1fd9 --- /dev/null +++ b/scenarios/create-100000-models.perf.md @@ -0,0 +1,50 @@ +--- +title: "Create 100000 models" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +const ModelWithPrimitivesAndActions = types + .model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, + }) + .actions((self) => ({ + setString(string) { + self.string = string; + }, + setNumber(number) { + self.number = number; + }, + setInteger(integer) { + self.integer = integer; + }, + setFloat(float) { + self.float = float; + }, + setBoolean(boolean) { + self.boolean = boolean; + }, + setDate(date) { + self.date = date; + }, + })); + +for (let i = 0; i < 100000; i++) { + ModelWithPrimitivesAndActions.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), + }); +} +``` diff --git a/scenarios/create-array-of-booleans.perf.md b/scenarios/create-array-of-booleans.perf.md new file mode 100644 index 0000000..6fc24a1 --- /dev/null +++ b/scenarios/create-array-of-booleans.perf.md @@ -0,0 +1,11 @@ +--- +title: "Create an array type with one boolean" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +types.array(types.integer).create([true]); +``` diff --git a/scenarios/create-array-of-dates.perf.md b/scenarios/create-array-of-dates.perf.md new file mode 100644 index 0000000..9e34c48 --- /dev/null +++ b/scenarios/create-array-of-dates.perf.md @@ -0,0 +1,11 @@ +--- +title: "Create an array type with one Date" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +types.array(types.Date).create([new Date()]); +``` diff --git a/scenarios/create-array-of-floats.perf.md b/scenarios/create-array-of-floats.perf.md new file mode 100644 index 0000000..0a33a62 --- /dev/null +++ b/scenarios/create-array-of-floats.perf.md @@ -0,0 +1,11 @@ +--- +title: "Create an array type with one float" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +types.array(types.integer).create([1.0]); +``` diff --git a/scenarios/create-array-of-integers.perf.md b/scenarios/create-array-of-integers.perf.md new file mode 100644 index 0000000..8c5e6e5 --- /dev/null +++ b/scenarios/create-array-of-integers.perf.md @@ -0,0 +1,11 @@ +--- +title: "Create an array type with one integer" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +types.array(types.integer).create([1]); +``` diff --git a/scenarios/create-array-of-numbers.perf.md b/scenarios/create-array-of-numbers.perf.md new file mode 100644 index 0000000..6b6d64e --- /dev/null +++ b/scenarios/create-array-of-numbers.perf.md @@ -0,0 +1,11 @@ +--- +title: "Create an array type with one number" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +types.array(types.number).create([1]); +``` diff --git a/scenarios/create-array-of-strings.perf.md b/scenarios/create-array-of-strings.perf.md new file mode 100644 index 0000000..46434f3 --- /dev/null +++ b/scenarios/create-array-of-strings.perf.md @@ -0,0 +1,11 @@ +--- +title: "Create an array type with one string" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +types.array(types.string).create(["string"]); +``` diff --git a/scenarios/create-boolean.perf.md b/scenarios/create-boolean.perf.md new file mode 100644 index 0000000..96af4f2 --- /dev/null +++ b/scenarios/create-boolean.perf.md @@ -0,0 +1,11 @@ +--- +title: "Create a boolean" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +types.boolean.create(true); +``` diff --git a/scenarios/create-date.perf.md b/scenarios/create-date.perf.md new file mode 100644 index 0000000..7b501a4 --- /dev/null +++ b/scenarios/create-date.perf.md @@ -0,0 +1,11 @@ +--- +title: "Create a date" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +types.Date.create(new Date()); +``` diff --git a/scenarios/create-float.perf.md b/scenarios/create-float.perf.md new file mode 100644 index 0000000..0d939fe --- /dev/null +++ b/scenarios/create-float.perf.md @@ -0,0 +1,11 @@ +--- +title: "Create a float" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +types.float.create(1.1); +``` diff --git a/scenarios/create-integer.perf.md b/scenarios/create-integer.perf.md new file mode 100644 index 0000000..8ea2700 --- /dev/null +++ b/scenarios/create-integer.perf.md @@ -0,0 +1,11 @@ +--- +title: "Create an integer" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +types.integer.create(1); +``` diff --git a/scenarios/create-map-of-booleans.perf.md b/scenarios/create-map-of-booleans.perf.md new file mode 100644 index 0000000..581206d --- /dev/null +++ b/scenarios/create-map-of-booleans.perf.md @@ -0,0 +1,11 @@ +--- +title: "Create a map type with one boolean in it" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +types.map(types.boolean).create({ boolean: true }); +``` diff --git a/scenarios/create-map-of-dates.perf.md b/scenarios/create-map-of-dates.perf.md new file mode 100644 index 0000000..2d179c0 --- /dev/null +++ b/scenarios/create-map-of-dates.perf.md @@ -0,0 +1,11 @@ +--- +title: "Create a map type with one Date in it" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +types.map(types.Date).create({ date: new Date() }); +``` diff --git a/scenarios/create-map-of-floats.perf.md b/scenarios/create-map-of-floats.perf.md new file mode 100644 index 0000000..966e102 --- /dev/null +++ b/scenarios/create-map-of-floats.perf.md @@ -0,0 +1,11 @@ +--- +title: "Create a map type with one float in it" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +types.map(types.float).create({ float: 1.1 }); +``` diff --git a/scenarios/create-map-of-integers.perf.md b/scenarios/create-map-of-integers.perf.md new file mode 100644 index 0000000..dfeed4d --- /dev/null +++ b/scenarios/create-map-of-integers.perf.md @@ -0,0 +1,11 @@ +--- +title: "Create a map type with one integer in it" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +types.map(types.integer).create({ integer: 1 }); +``` diff --git a/scenarios/create-map-of-numbers.perf.md b/scenarios/create-map-of-numbers.perf.md new file mode 100644 index 0000000..3ea7a89 --- /dev/null +++ b/scenarios/create-map-of-numbers.perf.md @@ -0,0 +1,11 @@ +--- +title: "Create a map type with one number in it" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +types.map(types.number).create({ number: 1 }); +``` diff --git a/scenarios/create-map-of-strings.perf.md b/scenarios/create-map-of-strings.perf.md new file mode 100644 index 0000000..34b9d6c --- /dev/null +++ b/scenarios/create-map-of-strings.perf.md @@ -0,0 +1,11 @@ +--- +title: "Create a map type with one string in it" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +types.map(types.string).create({ string: "string" }); +``` diff --git a/scenarios/create-model-add-actions-and-views.perf.md b/scenarios/create-model-add-actions-and-views.perf.md new file mode 100644 index 0000000..87370a8 --- /dev/null +++ b/scenarios/create-model-add-actions-and-views.perf.md @@ -0,0 +1,59 @@ +--- +title: "Create a model and add actions and views to it" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +const Model = types + .model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, + }) + .actions((self) => ({ + setString: (string) => { + self.string = string; + }, + setNumber: (number) => { + self.number = number; + }, + setInteger: (integer) => { + self.integer = integer; + }, + setFloat: (float) => { + self.float = float; + }, + setBoolean: (boolean) => { + self.boolean = boolean; + }, + setDate: (date) => { + self.date = date; + }, + })) + .views((self) => ({ + getString: () => { + return self.string; + }, + getNumber: () => { + return self.number; + }, + getInteger: () => { + return self.integer; + }, + getFloat: () => { + return self.float; + }, + getBoolean: () => { + return self.boolean; + }, + getDate: () => { + return self.date; + }, + })); +``` diff --git a/scenarios/create-model-add-actions.perf.md b/scenarios/create-model-add-actions.perf.md new file mode 100644 index 0000000..060d13b --- /dev/null +++ b/scenarios/create-model-add-actions.perf.md @@ -0,0 +1,39 @@ +--- +title: "Create a model and add actions to it" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +const Model = types + .model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, + }) + .actions((self) => ({ + setString: (string) => { + self.string = string; + }, + setNumber: (number) => { + self.number = number; + }, + setInteger: (integer) => { + self.integer = integer; + }, + setFloat: (float) => { + self.float = float; + }, + setBoolean: (boolean) => { + self.boolean = boolean; + }, + setDate: (date) => { + self.date = date; + }, + })); +``` diff --git a/scenarios/create-model-add-on-action.perf.md b/scenarios/create-model-add-on-action.perf.md new file mode 100644 index 0000000..a6420c3 --- /dev/null +++ b/scenarios/create-model-add-on-action.perf.md @@ -0,0 +1,32 @@ +--- +title: "Add onAction to a model" +--- + +```js +import { types, onAction } from "mobx-state-tree"; +``` + +```````js +const Todo = types.model({ + task: types.string, +}); + +const TodoStore = types + .model({ + todos: types.array(Todo), + }) + .actions((self) => ({ + add(todo) { + self.todos.push(todo); + }, + })); + +const s = TodoStore.create({ todos: [] }); + +let disposer = onAction(s, (call) => { + console.log(call); +}); + +return disposer; +``````; +``````` diff --git a/scenarios/create-model-add-views.perf.md b/scenarios/create-model-add-views.perf.md new file mode 100644 index 0000000..5d1a9b7 --- /dev/null +++ b/scenarios/create-model-add-views.perf.md @@ -0,0 +1,39 @@ +--- +title: "Create a model and add views to it" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +const Model = types + .model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, + }) + .views((self) => ({ + getString: () => { + return self.string; + }, + getNumber: () => { + return self.number; + }, + getInteger: () => { + return self.integer; + }, + getFloat: () => { + return self.float; + }, + getBoolean: () => { + return self.boolean; + }, + getDate: () => { + return self.date; + }, + })); +``` diff --git a/scenarios/create-model-set-boolean-value-applyaction.perf.md b/scenarios/create-model-set-boolean-value-applyaction.perf.md new file mode 100644 index 0000000..500b8a2 --- /dev/null +++ b/scenarios/create-model-set-boolean-value-applyaction.perf.md @@ -0,0 +1,54 @@ +--- +title: "Create 1 model and set a boolean value with applyAction" +--- + +```js +import { applyAction, types } from "mobx-state-tree"; +``` + +```js +const ModelWithPrimitivesAndActions = types + .model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, + }) + .actions((self) => ({ + setString(string) { + self.string = string; + }, + setNumber(number) { + self.number = number; + }, + setInteger(integer) { + self.integer = integer; + }, + setFloat(float) { + self.float = float; + }, + setBoolean(boolean) { + self.boolean = boolean; + }, + setDate(date) { + self.date = date; + }, + })); + +const m = ModelWithPrimitivesAndActions.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), +}); + +applyAction(m, { + name: "setBoolean", + path: "", + args: [false], +}); +``` diff --git a/scenarios/create-model-set-boolean-value.perf.md b/scenarios/create-model-set-boolean-value.perf.md new file mode 100644 index 0000000..7749ecf --- /dev/null +++ b/scenarios/create-model-set-boolean-value.perf.md @@ -0,0 +1,48 @@ +--- +title: "Create 1 model and set a boolean value" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +const ModelWithPrimitivesAndActions = types + .model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, + }) + .actions((self) => ({ + setString(string) { + self.string = string; + }, + setNumber(number) { + self.number = number; + }, + setInteger(integer) { + self.integer = integer; + }, + setFloat(float) { + self.float = float; + }, + setBoolean(boolean) { + self.boolean = boolean; + }, + setDate(date) { + self.date = date; + }, + })); + +ModelWithPrimitivesAndActions.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), +}).setBoolean(false); +``` diff --git a/scenarios/create-model-set-date-value.perf copy.md b/scenarios/create-model-set-date-value.perf copy.md new file mode 100644 index 0000000..ec185f5 --- /dev/null +++ b/scenarios/create-model-set-date-value.perf copy.md @@ -0,0 +1,54 @@ +--- +title: "Create 1 model and set a date value with applyAction" +--- + +```js +import { applyAction, types } from "mobx-state-tree"; +``` + +```js +const ModelWithPrimitivesAndActions = types + .model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, + }) + .actions((self) => ({ + setString(string) { + self.string = string; + }, + setNumber(number) { + self.number = number; + }, + setInteger(integer) { + self.integer = integer; + }, + setFloat(float) { + self.float = float; + }, + setBoolean(boolean) { + self.boolean = boolean; + }, + setDate(date) { + self.date = date; + }, + })); + +const m = ModelWithPrimitivesAndActions.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), +}); + +applyAction(m, { + name: "setDate", + path: "", + args: [new Date()], +}); +``` diff --git a/scenarios/create-model-set-date-value.perf.md b/scenarios/create-model-set-date-value.perf.md new file mode 100644 index 0000000..43aa81f --- /dev/null +++ b/scenarios/create-model-set-date-value.perf.md @@ -0,0 +1,48 @@ +--- +title: "Create 1 model and set a date value" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +const ModelWithPrimitivesAndActions = types + .model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, + }) + .actions((self) => ({ + setString(string) { + self.string = string; + }, + setNumber(number) { + self.number = number; + }, + setInteger(integer) { + self.integer = integer; + }, + setFloat(float) { + self.float = float; + }, + setBoolean(boolean) { + self.boolean = boolean; + }, + setDate(date) { + self.date = date; + }, + })); + +ModelWithPrimitivesAndActions.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), +}).setDate(new Date()); +``` diff --git a/scenarios/create-model-set-float-value-applyaction.perf.md b/scenarios/create-model-set-float-value-applyaction.perf.md new file mode 100644 index 0000000..7349c4f --- /dev/null +++ b/scenarios/create-model-set-float-value-applyaction.perf.md @@ -0,0 +1,54 @@ +--- +title: "Create 1 model and set a float value with applyAction" +--- + +```js +import { applyAction, types } from "mobx-state-tree"; +``` + +```js +const ModelWithPrimitivesAndActions = types + .model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, + }) + .actions((self) => ({ + setString(string) { + self.string = string; + }, + setNumber(number) { + self.number = number; + }, + setInteger(integer) { + self.integer = integer; + }, + setFloat(float) { + self.float = float; + }, + setBoolean(boolean) { + self.boolean = boolean; + }, + setDate(date) { + self.date = date; + }, + })); + +const m = ModelWithPrimitivesAndActions.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), +}); + +applyAction(m, { + name: "setFloat", + path: "", + args: [2.2], +}); +``` diff --git a/scenarios/create-model-set-float-value.perf.md b/scenarios/create-model-set-float-value.perf.md new file mode 100644 index 0000000..f7442b4 --- /dev/null +++ b/scenarios/create-model-set-float-value.perf.md @@ -0,0 +1,48 @@ +--- +title: "Create 1 model and set a string value" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +const ModelWithPrimitivesAndActions = types + .model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, + }) + .actions((self) => ({ + setString(string) { + self.string = string; + }, + setNumber(number) { + self.number = number; + }, + setInteger(integer) { + self.integer = integer; + }, + setFloat(float) { + self.float = float; + }, + setBoolean(boolean) { + self.boolean = boolean; + }, + setDate(date) { + self.date = date; + }, + })); + +ModelWithPrimitivesAndActions.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), +}).setFloat(1.25); +``` diff --git a/scenarios/create-model-set-integer-value-applyaction.perf.md b/scenarios/create-model-set-integer-value-applyaction.perf.md new file mode 100644 index 0000000..77bf431 --- /dev/null +++ b/scenarios/create-model-set-integer-value-applyaction.perf.md @@ -0,0 +1,54 @@ +--- +title: "Create 1 model and set a integer value with applyAction" +--- + +```js +import { applyAction, types } from "mobx-state-tree"; +``` + +```js +const ModelWithPrimitivesAndActions = types + .model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, + }) + .actions((self) => ({ + setString(string) { + self.string = string; + }, + setNumber(number) { + self.number = number; + }, + setInteger(integer) { + self.integer = integer; + }, + setFloat(float) { + self.float = float; + }, + setBoolean(boolean) { + self.boolean = boolean; + }, + setDate(date) { + self.date = date; + }, + })); + +const m = ModelWithPrimitivesAndActions.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), +}); + +applyAction(m, { + name: "setInteger", + path: "", + args: [2], +}); +``` diff --git a/scenarios/create-model-set-integer-value.perf.md b/scenarios/create-model-set-integer-value.perf.md new file mode 100644 index 0000000..1942ac4 --- /dev/null +++ b/scenarios/create-model-set-integer-value.perf.md @@ -0,0 +1,48 @@ +--- +title: "Create 1 model and set an integer value" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +const ModelWithPrimitivesAndActions = types + .model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, + }) + .actions((self) => ({ + setString(string) { + self.string = string; + }, + setNumber(number) { + self.number = number; + }, + setInteger(integer) { + self.integer = integer; + }, + setFloat(float) { + self.float = float; + }, + setBoolean(boolean) { + self.boolean = boolean; + }, + setDate(date) { + self.date = date; + }, + })); + +ModelWithPrimitivesAndActions.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), +}).setInteger(2); +``` diff --git a/scenarios/create-model-set-number-value-applyaction.perf.md b/scenarios/create-model-set-number-value-applyaction.perf.md new file mode 100644 index 0000000..caf87aa --- /dev/null +++ b/scenarios/create-model-set-number-value-applyaction.perf.md @@ -0,0 +1,54 @@ +--- +title: "Create 1 model and set a number value with applyAction" +--- + +```js +import { applyAction, types } from "mobx-state-tree"; +``` + +```js +const ModelWithPrimitivesAndActions = types + .model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, + }) + .actions((self) => ({ + setString(string) { + self.string = string; + }, + setNumber(number) { + self.number = number; + }, + setInteger(integer) { + self.integer = integer; + }, + setFloat(float) { + self.float = float; + }, + setBoolean(boolean) { + self.boolean = boolean; + }, + setDate(date) { + self.date = date; + }, + })); + +const m = ModelWithPrimitivesAndActions.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), +}); + +applyAction(m, { + name: "setNumber", + path: "", + args: [1], +}); +``` diff --git a/scenarios/create-model-set-number-value.perf.md b/scenarios/create-model-set-number-value.perf.md new file mode 100644 index 0000000..46430ff --- /dev/null +++ b/scenarios/create-model-set-number-value.perf.md @@ -0,0 +1,48 @@ +--- +title: "Create 1 model and set a number value" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +const ModelWithPrimitivesAndActions = types + .model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, + }) + .actions((self) => ({ + setString(string) { + self.string = string; + }, + setNumber(number) { + self.number = number; + }, + setInteger(integer) { + self.integer = integer; + }, + setFloat(float) { + self.float = float; + }, + setBoolean(boolean) { + self.boolean = boolean; + }, + setDate(date) { + self.date = date; + }, + })); + +ModelWithPrimitivesAndActions.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), +}).setNumber(2); +``` diff --git a/scenarios/create-model-set-string-value-applyaction.perf.md b/scenarios/create-model-set-string-value-applyaction.perf.md new file mode 100644 index 0000000..6c83442 --- /dev/null +++ b/scenarios/create-model-set-string-value-applyaction.perf.md @@ -0,0 +1,54 @@ +--- +title: "Create 1 model and set a string value with applyAction" +--- + +```js +import { applyAction, types } from "mobx-state-tree"; +``` + +```js +const ModelWithPrimitivesAndActions = types + .model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, + }) + .actions((self) => ({ + setString(string) { + self.string = string; + }, + setNumber(number) { + self.number = number; + }, + setInteger(integer) { + self.integer = integer; + }, + setFloat(float) { + self.float = float; + }, + setBoolean(boolean) { + self.boolean = boolean; + }, + setDate(date) { + self.date = date; + }, + })); + +const m = ModelWithPrimitivesAndActions.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), +}); + +applyAction(m, { + name: "setString", + path: "", + args: ["new string"], +}); +``` diff --git a/scenarios/create-model-set-string-value.perf.md b/scenarios/create-model-set-string-value.perf.md new file mode 100644 index 0000000..8f6b848 --- /dev/null +++ b/scenarios/create-model-set-string-value.perf.md @@ -0,0 +1,48 @@ +--- +title: "Create 1 model and set a string value" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +const ModelWithPrimitivesAndActions = types + .model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, + }) + .actions((self) => ({ + setString(string) { + self.string = string; + }, + setNumber(number) { + self.number = number; + }, + setInteger(integer) { + self.integer = integer; + }, + setFloat(float) { + self.float = float; + }, + setBoolean(boolean) { + self.boolean = boolean; + }, + setDate(date) { + self.date = date; + }, + })); + +ModelWithPrimitivesAndActions.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), +}).setString("new string"); +``` diff --git a/scenarios/create-model-with-snapshot-listener.perf.md b/scenarios/create-model-with-snapshot-listener.perf.md new file mode 100644 index 0000000..d7bacc4 --- /dev/null +++ b/scenarios/create-model-with-snapshot-listener.perf.md @@ -0,0 +1,33 @@ +--- +title: "Create a model with a snapshot listener" +--- + +```js +import { types, getSnapshot, applySnapshot, onSnapshot } from "mobx-state-tree"; +``` + +```js +const Model = types.model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, +}); + +const m = Model.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), +}); + +onSnapshot(m, (snapshot) => { + return snapshot; +}); + +return m; +``` diff --git a/scenarios/create-number.perf.md b/scenarios/create-number.perf.md new file mode 100644 index 0000000..ca8f950 --- /dev/null +++ b/scenarios/create-number.perf.md @@ -0,0 +1,11 @@ +--- +title: "Create a number" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +types.number.create(1); +``` diff --git a/scenarios/create-string.perf.md b/scenarios/create-string.perf.md new file mode 100644 index 0000000..dda5f7d --- /dev/null +++ b/scenarios/create-string.perf.md @@ -0,0 +1,11 @@ +--- +title: "Create a string" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +types.string.create("string"); +``` diff --git a/scenarios/declare-reference-and-retrieve-it.md b/scenarios/declare-reference-and-retrieve-it.md new file mode 100644 index 0000000..bbd6d2e --- /dev/null +++ b/scenarios/declare-reference-and-retrieve-it.md @@ -0,0 +1,32 @@ +--- +title: "Declare a model with a reference and retrieve a value from it" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +const Todo = types.model({ + id: types.identifier, + title: types.string, +}); + +const TodoStore = types.model({ + todos: types.array(Todo), + selectedTodo: types.reference(Todo), +}); + +// create a store with a normalized snapshot +const storeInstance = TodoStore.create({ + todos: [ + { + id: "47", + title: "Get coffee", + }, + ], + selectedTodo: "47", +}); + +return storeInstance.selectedTodo.title; // "Get coffee" +``` diff --git a/scenarios/derived-values.js b/scenarios/derived-values.js deleted file mode 100644 index 8a6336b..0000000 --- a/scenarios/derived-values.js +++ /dev/null @@ -1,47 +0,0 @@ -import { types } from "mobx-state-tree"; - -const User = types.model({ - id: types.identifier, - name: types.string, - age: types.number, -}); - -const UserStore = types - .model({ - users: types.array(User), - }) - .views((self) => ({ - get numberOfChildren() { - return self.users.filter((user) => user.age < 18).length; - }, - numberOfPeopleOlderThan(age) { - return self.users.filter((user) => user.age > age).length; - }, - })); - -const userStore = UserStore.create({ - users: [ - { id: "1", name: "John", age: 42 }, - { id: "2", name: "Jane", age: 47 }, - ], -}); - -export const getComputedValueOnce = () => { - return userStore.numberOfChildren; -}; - -export const getComputedValueTwice = () => { - const numberOfChildren = userStore.numberOfChildren; - const numberOfChildrenAgain = userStore.numberOfChildren; - return numberOfChildrenAgain; -}; - -export const getViewWithParameter = () => { - return userStore.numberOfPeopleOlderThan(50); -}; - -export const getViewWithParameterTwice = () => { - const numberOfPeopleOlderThan = userStore.numberOfPeopleOlderThan(50); - const numberOfPeopleOlderThanAgain = userStore.numberOfPeopleOlderThan(50); - return numberOfPeopleOlderThanAgain; -}; diff --git a/scenarios/execute-simple-snapshot-listener.perf.md b/scenarios/execute-simple-snapshot-listener.perf.md new file mode 100644 index 0000000..9bec4c0 --- /dev/null +++ b/scenarios/execute-simple-snapshot-listener.perf.md @@ -0,0 +1,43 @@ +--- +title: "Execute a simple snapshot listener" +--- + +```js +import { types, getSnapshot, applySnapshot, onSnapshot } from "mobx-state-tree"; +``` + +```js +const Model = types + .model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, + }) + .actions((self) => { + const changeString = (newString) => { + self.string = newString; + }; + + return { + changeString, + }; + }); + +const m = Model.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), +}); + +onSnapshot(m, (snapshot) => { + return snapshot; +}); + +m.changeString("newString"); +``` diff --git a/scenarios/get-computed-value-once.perf.md b/scenarios/get-computed-value-once.perf.md new file mode 100644 index 0000000..f07ec49 --- /dev/null +++ b/scenarios/get-computed-value-once.perf.md @@ -0,0 +1,38 @@ +--- +title: "Get computed value once" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +const User = types.model({ + id: types.identifier, + name: types.string, + age: types.number, +}); + +const UserStore = types + .model({ + users: types.array(User), + }) + .views((self) => ({ + get numberOfChildren() { + return self.users.filter((user) => user.age < 18).length; + }, + numberOfPeopleOlderThan(age) { + return self.users.filter((user) => user.age > age).length; + }, + })); + +const userStore = UserStore.create({ + users: [ + { id: "1", name: "John", age: 42 }, + { id: "2", name: "Jane", age: 47 }, + ], +}); + +const numberOfChildren = userStore.numberOfChildren; +return numberOfChildren; +``` diff --git a/scenarios/get-computed-value-twice.perf.md b/scenarios/get-computed-value-twice.perf.md new file mode 100644 index 0000000..c4ba094 --- /dev/null +++ b/scenarios/get-computed-value-twice.perf.md @@ -0,0 +1,39 @@ +--- +title: "Get computed value once (should be cached)" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +const User = types.model({ + id: types.identifier, + name: types.string, + age: types.number, +}); + +const UserStore = types + .model({ + users: types.array(User), + }) + .views((self) => ({ + get numberOfChildren() { + return self.users.filter((user) => user.age < 18).length; + }, + numberOfPeopleOlderThan(age) { + return self.users.filter((user) => user.age > age).length; + }, + })); + +const userStore = UserStore.create({ + users: [ + { id: "1", name: "John", age: 42 }, + { id: "2", name: "Jane", age: 47 }, + ], +}); + +const numberOfChildren = userStore.numberOfChildren; +const numberOfChildrenAgain = userStore.numberOfChildren; +return numberOfChildrenAgain; +``` diff --git a/scenarios/get-snapshot-of-model.perf.md b/scenarios/get-snapshot-of-model.perf.md new file mode 100644 index 0000000..c8e1105 --- /dev/null +++ b/scenarios/get-snapshot-of-model.perf.md @@ -0,0 +1,30 @@ +--- +title: "Get a snapshot of a model" +--- + +```js +import { types, getSnapshot } from "mobx-state-tree"; +``` + +```js +const Model = types.model({ + string: types.string, + number: types.number, + integer: types.integer, + float: types.float, + boolean: types.boolean, + date: types.Date, +}); + +const m = Model.create({ + string: "string", + number: 1, + integer: 1, + float: 1.1, + boolean: true, + date: new Date(), +}); + +const snapshot = getSnapshot(m); +return snapshot; +``` diff --git a/scenarios/get-view-with-parameter-twice.perf.md b/scenarios/get-view-with-parameter-twice.perf.md new file mode 100644 index 0000000..d549ffa --- /dev/null +++ b/scenarios/get-view-with-parameter-twice.perf.md @@ -0,0 +1,40 @@ +--- +title: "Get a view with a parameter twice (should not be cached)" +--- + +```js +import { types } from "mobx-state-tree"; +k; +``` + +```js +const User = types.model({ + id: types.identifier, + name: types.string, + age: types.number, +}); + +const UserStore = types + .model({ + users: types.array(User), + }) + .views((self) => ({ + get numberOfChildren() { + return self.users.filter((user) => user.age < 18).length; + }, + numberOfPeopleOlderThan(age) { + return self.users.filter((user) => user.age > age).length; + }, + })); + +const userStore = UserStore.create({ + users: [ + { id: "1", name: "John", age: 42 }, + { id: "2", name: "Jane", age: 47 }, + ], +}); + +const numberOfPeopleOlderThan = userStore.numberOfPeopleOlderThan(50); +const numberOfPeopleOlderThanAgain = userStore.numberOfPeopleOlderThan(50); +return numberOfPeopleOlderThanAgain; +``` diff --git a/scenarios/get-view-with-parameter.perf.md b/scenarios/get-view-with-parameter.perf.md new file mode 100644 index 0000000..4e54c85 --- /dev/null +++ b/scenarios/get-view-with-parameter.perf.md @@ -0,0 +1,38 @@ +--- +title: "Get a view with a parameter" +--- + +```js +import { types } from "mobx-state-tree"; +k; +``` + +```js +const User = types.model({ + id: types.identifier, + name: types.string, + age: types.number, +}); + +const UserStore = types + .model({ + users: types.array(User), + }) + .views((self) => ({ + get numberOfChildren() { + return self.users.filter((user) => user.age < 18).length; + }, + numberOfPeopleOlderThan(age) { + return self.users.filter((user) => user.age > age).length; + }, + })); + +const userStore = UserStore.create({ + users: [ + { id: "1", name: "John", age: 42 }, + { id: "2", name: "Jane", age: 47 }, + ], +}); + +return userStore.numberOfPeopleOlderThan(50); +``` diff --git a/scenarios/index.js b/scenarios/index.js deleted file mode 100644 index f6680f9..0000000 --- a/scenarios/index.js +++ /dev/null @@ -1,986 +0,0 @@ -import { - ModelWithPrimitivesAndActions, - createNModels, -} from "./model-creation.js"; -import { - addMiddleware, - applyAction, - getSnapshot, - types, -} from "mobx-state-tree"; -import { - mstTypeCheckModelSuccess, - mstTypeCheckModelFailure, - mstTypeCheckSnapshotSuccess, - mstTypeCheckSnapshotFailure, - zodTypeCheckSuccess, - zodTypeCheckFailure, -} from "./zod-comparison.js"; -import { - declareReferenceAndRetrieveIt, - refineAReferenceAndSucceed, - refineAReferenceAndFail, - checkIfReferenceIsValidAndFail, - checkIfReferenceIsValidAndSucceed, - tryReferenceAndFail, - tryReferenceAndSucceed, -} from "./references.js"; -import { - getComputedValueOnce, - getComputedValueTwice, - getViewWithParameter, - getViewWithParameterTwice, -} from "./derived-values.js"; -import { addNObjectsToArray } from "./array-operations.js"; -import { - takeSingleSnapshot, - createModelWithSnapshotListener, - executeSimpleSnapshotListenerFromAction, - applySnapshotToModel, - applySnapshotToModelWithListener, -} from "./snapshots.js"; -import { - attachPatchListenerToModel, - executeSimplePatchFromAction, -} from "./patches.js"; -/** - * Below, write scenarios. Each scenario should be exported. - * It should be an object with a title, descriptoin, and a function. - * - * Feel free to write helper functions or split things up in this directory, - * but make sure that the scenario is exported and has a title and longDescription, - * along with a function to run. That will get picked up in ../runner.js - */ - -// Scenario 1 is just creating one model -export const scenario1 = { - title: "Create 1 model", - longDescription: - "Create 1 model with all primitive types, along with a setter action for each.", - run: () => { - createNModels(1); - }, -}; - -// Scenario 2 is creating 10 models -export const scenario2 = { - title: "Create 10 models", - longDescription: - "Create 10 models with all primitive types, along with a setter action for each.", - run: () => { - createNModels(10); - }, -}; - -// Scenario 3 is creating 100 models -export const scenario3 = { - title: "Create 100 models", - longDescription: - "Create 100 models with all primitive types, along with a setter action for each.", - run: () => { - createNModels(100); - }, -}; - -// Scenario 4 is creating 1,000 models -export const scenario4 = { - title: "Create 1,000 models", - longDescription: - "Create 1,000 models with all primitive types, along with a setter action for each.", - run: () => { - createNModels(1000); - }, -}; - -// Scenario 5 is creating 10,000 models -export const scenario5 = { - title: "Create 10,000 models", - longDescription: - "Create 10,000 models with all primitive types, along with a setter action for each.", - run: () => { - createNModels(10000); - }, -}; - -// Scenario 6 is creating 100,000 models -export const scenario6 = { - title: "Create 100,000 models", - longDescription: - "Create 100,000 models with all primitive types, along with a setter action for each.", - run: () => { - createNModels(100000); - }, -}; - -// Scenario 7 creates 1 model and sets a string value -export const scenario7 = { - title: "Create 1 model and set a string value", - longDescription: - "Create 1 model with all primitive types, along with a setter action for each. Then, set a string value.", - run: () => { - ModelWithPrimitivesAndActions.create({ - string: "string", - number: 1, - integer: 1, - float: 1.1, - boolean: true, - date: new Date(), - }).setString("new string"); - }, -}; - -// Scenario 8 creates 1 model and sets a number value -export const scenario8 = { - title: "Create 1 model and set a number value", - longDescription: - "Create 1 model with all primitive types, along with a setter action for each. Then, set a number value.", - run: () => { - ModelWithPrimitivesAndActions.create({ - string: "string", - number: 1, - integer: 1, - float: 1.1, - boolean: true, - date: new Date(), - }).setNumber(2); - }, -}; - -// Scenario 9 creates 1 model and sets an integer value -export const scenario9 = { - title: "Create 1 model and set an integer value", - longDescription: - "Create 1 model with all primitive types, along with a setter action for each. Then, set an integer value.", - run: () => { - ModelWithPrimitivesAndActions.create({ - string: "string", - number: 1, - integer: 1, - float: 1.1, - boolean: true, - date: new Date(), - }).setInteger(2); - }, -}; - -// Scenario 10 creates 1 model and sets a float value -export const scenario10 = { - title: "Create 1 model and set a float value", - longDescription: - "Create 1 model with all primitive types, along with a setter action for each. Then, set a float value.", - run: () => { - ModelWithPrimitivesAndActions.create({ - string: "string", - number: 1, - integer: 1, - float: 1.1, - boolean: true, - date: new Date(), - }).setFloat(2.2); - }, -}; - -// Scenario 11 creates 1 model and sets a boolean value -export const scenario11 = { - title: "Create 1 model and set a boolean value", - longDescription: - "Create 1 model with all primitive types, along with a setter action for each. Then, set a boolean value.", - run: () => { - ModelWithPrimitivesAndActions.create({ - string: "string", - number: 1, - integer: 1, - float: 1.1, - boolean: true, - date: new Date(), - }).setBoolean(false); - }, -}; - -// Scenario 12 creates 1 model and sets a date value -export const scenario12 = { - title: "Create 1 model and set a date value", - longDescription: - "Create 1 model with all primitive types, along with a setter action for each. Then, set a date value.", - run: () => { - ModelWithPrimitivesAndActions.create({ - string: "string", - number: 1, - integer: 1, - float: 1.1, - boolean: true, - date: new Date(), - }).setDate(new Date()); - }, -}; - -// Create a types.string -export const scenario13 = { - title: "Create a types.string", - longDescription: "Create a types.string.", - run: () => { - types.string.create("string"); - }, -}; - -// Create a types.number -export const scenario14 = { - title: "Create a types.number", - longDescription: "Create a types.number.", - run: () => { - types.number.create(1); - }, -}; - -// Create a types.integer -export const scenario15 = { - title: "Create a types.integer", - longDescription: "Create a types.integer.", - run: () => { - types.integer.create(1); - }, -}; - -// Create a types.float -export const scenario16 = { - title: "Create a types.float", - longDescription: "Create a types.float.", - run: () => { - types.float.create(1.1); - }, -}; - -// Create a types.boolean -export const scenario17 = { - title: "Create a types.boolean", - longDescription: "Create a types.boolean.", - run: () => { - types.boolean.create(true); - }, -}; - -// Create a types.Date -export const scenario18 = { - title: "Create a types.Date", - longDescription: "Create a types.Date.", - run: () => { - types.Date.create(new Date()); - }, -}; - -// Create a types.array(types.string) -export const scenario19 = { - title: "Create a types.array(types.string)", - longDescription: "Create a types.array(types.string).", - run: () => { - types.array(types.string).create(["string"]); - }, -}; - -// Create a types.array(types.number) -export const scenario20 = { - title: "Create a types.array(types.number)", - longDescription: "Create a types.array(types.number).", - run: () => { - types.array(types.number).create([1]); - }, -}; - -// Create a types.array(types.integer) -export const scenario21 = { - title: "Create a types.array(types.integer)", - longDescription: "Create a types.array(types.integer).", - run: () => { - types.array(types.integer).create([1]); - }, -}; - -// Create a types.array(types.float) -export const scenario22 = { - title: "Create a types.array(types.float)", - longDescription: "Create a types.array(types.float).", - run: () => { - types.array(types.float).create([1.1]); - }, -}; - -// Create a types.array(types.boolean) -export const scenario23 = { - title: "Create a types.array(types.boolean)", - longDescription: "Create a types.array(types.boolean).", - run: () => { - types.array(types.boolean).create([true]); - }, -}; - -// Create a types.array(types.Date) -export const scenario24 = { - title: "Create a types.array(types.Date)", - longDescription: "Create a types.array(types.Date).", - run: () => { - types.array(types.Date).create([new Date()]); - }, -}; - -// Create a types.map(types.string) -export const scenario25 = { - title: "Create a types.map(types.string)", - longDescription: "Create a types.map(types.string).", - run: () => { - types.map(types.string).create({ string: "string" }); - }, -}; - -// Create a types.map(types.number) -export const scenario26 = { - title: "Create a types.map(types.number)", - longDescription: "Create a types.map(types.number).", - run: () => { - types.map(types.number).create({ number: 1 }); - }, -}; - -// Create a types.map(types.integer) -export const scenario27 = { - title: "Create a types.map(types.integer)", - longDescription: "Create a types.map(types.integer).", - run: () => { - types.map(types.integer).create({ integer: 1 }); - }, -}; - -// Create a types.map(types.float) -export const scenario28 = { - title: "Create a types.map(types.float)", - longDescription: "Create a types.map(types.float).", - run: () => { - types.map(types.float).create({ float: 1.1 }); - }, -}; - -// Create a types.map(types.boolean) -export const scenario29 = { - title: "Create a types.map(types.boolean)", - longDescription: "Create a types.map(types.boolean).", - run: () => { - types.map(types.boolean).create({ boolean: true }); - }, -}; - -// Create a types.map(types.Date) -export const scenario30 = { - title: "Create a types.map(types.Date)", - longDescription: "Create a types.map(types.Date).", - run: () => { - types.map(types.Date).create({ date: new Date() }); - }, -}; - -export const scenario31 = { - title: "Check a valid model with MST typecheck", - run: () => { - mstTypeCheckModelSuccess(); - }, -}; - -export const scenario32 = { - title: "Check an invalid model with MST typecheck", - run: () => { - mstTypeCheckModelFailure(); - }, -}; - -export const scenario33 = { - title: "Check a valid snapshot with MST typecheck", - run: () => { - mstTypeCheckSnapshotSuccess(); - }, -}; - -export const scenario34 = { - title: "Check an invalid snapshot with MST typecheck", - run: () => { - mstTypeCheckSnapshotFailure(); - }, -}; - -export const scenario35 = { - title: "Check a valid model with Zod typecheck", - run: () => { - zodTypeCheckSuccess(); - }, -}; - -export const scenario36 = { - title: "Check an invalid model with Zod typecheck", - run: () => { - zodTypeCheckFailure(); - }, -}; - -export const scenario37 = { - title: "Create a model and add actions to it", - run: () => { - const Model = types - .model({ - string: types.string, - number: types.number, - integer: types.integer, - float: types.float, - boolean: types.boolean, - date: types.Date, - }) - .actions((self) => ({ - setString: (string) => { - self.string = string; - }, - setNumber: (number) => { - self.number = number; - }, - setInteger: (integer) => { - self.integer = integer; - }, - setFloat: (float) => { - self.float = float; - }, - setBoolean: (boolean) => { - self.boolean = boolean; - }, - setDate: (date) => { - self.date = date; - }, - })); - - Model.create({ - string: "string", - number: 1, - integer: 1, - float: 1.1, - boolean: true, - date: new Date(), - }).setString("new string"); - }, -}; - -export const scenario38 = { - title: "Create a model and add views to it", - run: () => { - const Model = types - .model({ - string: types.string, - number: types.number, - integer: types.integer, - float: types.float, - boolean: types.boolean, - date: types.Date, - }) - .views((self) => ({ - getString: () => { - return self.string; - }, - getNumber: () => { - return self.number; - }, - getInteger: () => { - return self.integer; - }, - getFloat: () => { - return self.float; - }, - getBoolean: () => { - return self.boolean; - }, - getDate: () => { - return self.date; - }, - })); - - Model.create({ - string: "string", - number: 1, - integer: 1, - float: 1.1, - boolean: true, - date: new Date(), - }).getString(); - }, -}; - -export const scenario39 = { - title: "Create a model and add both actions and views to it", - run: () => { - const Model = types - .model({ - string: types.string, - number: types.number, - integer: types.integer, - float: types.float, - boolean: types.boolean, - date: types.Date, - }) - .actions((self) => ({ - setString: (string) => { - self.string = string; - }, - setNumber: (number) => { - self.number = number; - }, - setInteger: (integer) => { - self.integer = integer; - }, - setFloat: (float) => { - self.float = float; - }, - setBoolean: (boolean) => { - self.boolean = boolean; - }, - setDate: (date) => { - self.date = date; - }, - })) - .views((self) => ({ - getString: () => { - return self.string; - }, - getNumber: () => { - return self.number; - }, - getInteger: () => { - return self.integer; - }, - getFloat: () => { - return self.float; - }, - getBoolean: () => { - return self.boolean; - }, - getDate: () => { - return self.date; - }, - })); - - Model.create({ - string: "string", - number: 1, - integer: 1, - float: 1.1, - boolean: true, - date: new Date(), - }).getString(); - }, -}; - -export const scenario40 = { - title: "Declare a model with a reference and retrieve a value from it", - run: () => { - declareReferenceAndRetrieveIt(); - }, -}; - -export const scenario41 = { - title: "Add onAction to a model", - run: () => { - const Todo = types.model({ - task: types.string, - }); - - const TodoStore = types - .model({ - todos: types.array(Todo), - }) - .actions((self) => ({ - add(todo) { - self.todos.push(todo); - }, - })); - - const s = TodoStore.create({ todos: [] }); - - let disposer = onAction(s, (call) => { - console.log(call); - }); - - return disposer; - }, -}; - -export const scenario42 = { - title: "Add middleware to an action and include hooks (default)", - run: () => { - const Todo = types.model({ - task: types.string, - }); - - const TodoStore = types - .model({ - todos: types.array(Todo), - }) - .actions((self) => ({ - add(todo) { - self.todos.push(todo); - }, - })); - - const s = TodoStore.create({ todos: [] }); - - addMiddleware(s, () => {}); - }, -}; - -export const scenario43 = { - title: "Add middleware to an action and do not include hooks", - run: () => { - const Todo = types.model({ - task: types.string, - }); - - const TodoStore = types - .model({ - todos: types.array(Todo), - }) - .actions((self) => ({ - add(todo) { - self.todos.push(todo); - }, - })); - - const s = TodoStore.create({ todos: [] }); - - addMiddleware(s, () => {}, false); - }, -}; - -export const scenario44 = { - title: "Create 1 model and set a string value using applyAction", - run: () => { - ModelWithPrimitivesAndActions.create({ - string: "string", - number: 1, - integer: 1, - float: 1.1, - boolean: true, - date: new Date(), - }); - - applyAction(ModelWithPrimitivesAndActions, { - name: "setString", - path: "", - args: ["new string"], - }); - }, -}; - -export const scenario45 = { - title: "Create 1 model and set a number value using applyAction", - run: () => { - ModelWithPrimitivesAndActions.create({ - string: "string", - number: 1, - integer: 1, - float: 1.1, - boolean: true, - date: new Date(), - }); - - applyAction(ModelWithPrimitivesAndActions, { - name: "setNumber", - path: "", - args: [2], - }); - }, -}; - -export const scenario46 = { - title: "Create 1 model and set an integer value using applyAction", - run: () => { - ModelWithPrimitivesAndActions.create({ - string: "string", - number: 1, - integer: 1, - float: 1.1, - boolean: true, - date: new Date(), - }); - - applyAction(ModelWithPrimitivesAndActions, { - name: "setInteger", - path: "", - args: [2], - }); - }, -}; - -export const scenario47 = { - title: "Create 1 model and set a float value using applyAction", - run: () => { - ModelWithPrimitivesAndActions.create({ - string: "string", - number: 1, - integer: 1, - float: 1.1, - boolean: true, - date: new Date(), - }); - - applyAction(ModelWithPrimitivesAndActions, { - name: "setFloat", - path: "", - args: [2.2], - }); - }, -}; - -export const scenario48 = { - title: "Create 1 model and set a boolean value using applyAction", - run: () => { - ModelWithPrimitivesAndActions.create({ - string: "string", - number: 1, - integer: 1, - float: 1.1, - boolean: true, - date: new Date(), - }); - - applyAction(ModelWithPrimitivesAndActions, { - name: "setBoolean", - path: "", - args: [false], - }); - }, -}; - -export const scenario49 = { - title: "Create 1 model and set a date value using applyAction", - run: () => { - ModelWithPrimitivesAndActions.create({ - string: "string", - number: 1, - integer: 1, - float: 1.1, - boolean: true, - date: new Date(), - }); - - applyAction(ModelWithPrimitivesAndActions, { - name: "setDate", - path: "", - args: [new Date()], - }); - }, -}; - -export const scenario50 = { - title: "Get a computed value once", - run: () => { - getComputedValueOnce(); - }, -}; - -export const scenario51 = { - title: "Get a computed value twice (should be cached)", - run: () => { - getComputedValueTwice(); - }, -}; - -export const scenario52 = { - title: "Get a view with a parameter once", - run: () => { - getViewWithParameter(); - }, -}; - -export const scenario53 = { - title: "Get a view with a parameter twice (not cached)", - run: () => { - getViewWithParameterTwice(); - }, -}; - -/** - * Different permutations of a requested benchmark from - * https://github.com/coolsoftwaretyler/mst-performance-testing/issues/26 - */ -export const scenario54 = { - title: "Add 1 object to an array", - run: () => { - addNObjectsToArray(1); - }, -}; - -export const scenario55 = { - title: "Add 10 objects to an array", - run: () => { - addNObjectsToArray(10); - }, -}; - -export const scenario56 = { - title: "Add 100 objects to an array", - run: () => { - addNObjectsToArray(100); - }, -}; - -export const scenario57 = { - title: "Add 1,000 objects to an array", - run: () => { - addNObjectsToArray(1000); - }, -}; - -export const scenario58 = { - title: "Add 10,000 objects to an array", - run: () => { - addNObjectsToArray(10000); - }, -}; - -export const scenario59 = { - title: "Add 100,000 objects to an array", - run: () => { - addNObjectsToArray(100000); - }, -}; - -export const scenario60 = { - title: "Get a snapshot of a model", - run: () => { - takeSingleSnapshot(); - }, -}; - -export const scenario61 = { - title: "Define and create a model with an onSnapshot listener", - run: () => { - createModelWithSnapshotListener(); - }, -}; - -export const scenario62 = { - title: "Execute a simple onSnapshot listener from an action", - run: () => { - executeSimpleSnapshotListenerFromAction(); - }, -}; - -export const scenario63 = { - title: "Apply a snapshot to a model", - run: () => { - applySnapshotToModel(); - }, -}; - -export const scenario64 = { - title: "Apply a snapshot to a model with a listener", - run: () => { - applySnapshotToModelWithListener(); - }, -}; - -export const scenario65 = { - title: "Refine a reference and succeed", - run: () => { - refineAReferenceAndSucceed(); - }, -}; - -export const scenario66 = { - title: "Refine a reference and fail", - run: () => { - refineAReferenceAndFail(); - }, -}; - -export const scenario67 = { - title: "Check if reference is valid and fail", - run: () => { - checkIfReferenceIsValidAndFail(); - }, -}; - -export const scenario68 = { - title: "Check if reference is valid and succeed", - run: () => { - checkIfReferenceIsValidAndSucceed(); - }, -}; - -export const scenario69 = { - title: "Try reference and fail", - run: () => { - tryReferenceAndFail(); - }, -}; - -export const scenario70 = { - title: "Try reference and succeed", - run: () => { - tryReferenceAndSucceed(); - }, -}; - -export const scenario71 = { - title: "Attach a patch listener to a model", - run: () => { - attachPatchListenerToModel(); - }, -}; - -export const scenario72 = { - title: "Execute a simple patch from an action", - run: () => { - executeSimplePatchFromAction(); - }, -}; - -export const scenario73 = { - title: "Attach middleware", - run: () => { - const Todo = types.model({ - task: types.string, - }); - - const TodoStore = types - .model({ - todos: types.array(Todo), - }) - .actions((self) => ({ - add(todo) { - self.todos.push(todo); - }, - })); - - const s = TodoStore.create({ todos: [] }); - - addMiddleware(s, () => {}); - }, -}; - -export const scenario74 = { - title: "Attach middleware and use it", - run: () => { - const Todo = types.model({ - task: types.string, - }); - - const TodoStore = types - .model({ - todos: types.array(Todo), - }) - .actions((self) => ({ - add(todo) { - self.todos.push(todo); - }, - })); - - const s = TodoStore.create({ todos: [] }); - - addMiddleware(s, (call, next) => { - next(call); - }); - - s.add({ task: "string" }); - }, -}; diff --git a/scenarios/patches.js b/scenarios/patches.js deleted file mode 100644 index 6897f0f..0000000 --- a/scenarios/patches.js +++ /dev/null @@ -1,42 +0,0 @@ -import { types, onPatch, applyPatch } from "mobx-state-tree"; - -const Model = types.model({ - string: types.string, - number: types.number, - integer: types.integer, - float: types.float, - boolean: types.boolean, - date: types.Date, -}); - -export const attachPatchListenerToModel = () => { - const m = Model.create({ - string: "string", - number: 1, - integer: 1, - float: 1.1, - boolean: true, - date: new Date(), - }); - - onPatch(m, (patch) => { - return patch; - }); -}; - -export const executeSimplePatchFromAction = () => { - const m = Model.create({ - string: "string", - number: 1, - integer: 1, - float: 1.1, - boolean: true, - date: new Date(), - }); - - applyPatch(m, { - op: "replace", - path: "/string", - value: "new string", - }); -}; diff --git a/scenarios/references.js b/scenarios/references.js deleted file mode 100644 index dd04b5d..0000000 --- a/scenarios/references.js +++ /dev/null @@ -1,193 +0,0 @@ -import { - isValidReference, - types, - tryReference, - applySnapshot, -} from "mobx-state-tree"; - -export const declareReferenceAndRetrieveIt = () => { - const Todo = types.model({ - id: types.identifier, - title: types.string, - }); - - const TodoStore = types.model({ - todos: types.array(Todo), - selectedTodo: types.reference(Todo), - }); - - // create a store with a normalized snapshot - const storeInstance = TodoStore.create({ - todos: [ - { - id: "47", - title: "Get coffee", - }, - ], - selectedTodo: "47", - }); - - return storeInstance.selectedTodo.title; // "Get coffee" -}; - -export const refineAReferenceAndSucceed = () => { - const Car = types.model("Car", { - id: types.refinement( - types.identifier, - (identifier) => identifier.indexOf("Car_") === 0 - ), - }); - - const CarStore = types.model("CarStore", { - cars: types.array(Car), - selectedCar: types.reference(Car), - }); - - // create a store with a normalized snapshot - const storeInstance = CarStore.create({ - cars: [ - { - id: "Car_47", - }, - ], - selectedCar: "Car_47", - }); - - return storeInstance.selectedCar.id; // "Car_47" -}; - -export const refineAReferenceAndFail = () => { - const Car = types.model("Car", { - id: types.refinement( - types.identifier, - (identifier) => identifier.indexOf("Car_") === 0 - ), - }); - - const CarStore = types.model("CarStore", { - cars: types.array(Car), - selectedCar: types.reference(Car), - }); - - // create a store with a normalized snapshot - const storeInstance = CarStore.create({ - cars: [ - { - id: "47", - }, - ], - selectedCar: "47", - }); - - return storeInstance.selectedCar.id; // throws -}; - -export const checkIfReferenceIsValidAndSucceed = () => { - const Car = types.model("Car", { - id: types.identifier, - }); - - const CarStore = types.model("CarStore", { - cars: types.array(Car), - selectedCar: types.reference(Car), - }); - - // create a store with a normalized snapshot - const store = CarStore.create({ - cars: [ - { - id: "47", - }, - ], - selectedCar: "47", - }); - - const isValid = isValidReference(() => store.selectedCar); - - return isValid; -}; - -export const checkIfReferenceIsValidAndFail = () => { - const Car = types.model("Car", { - id: types.identifier, - }); - - const CarStore = types.model("CarStore", { - cars: types.array(Car), - selectedCar: types.reference(Car), - }); - - // create a store with a normalized snapshot - const store = CarStore.create({ - cars: [ - { - id: "47", - }, - ], - selectedCar: "47", - }); - - applySnapshot(store, { - ...store, - selectedCar: "48", - }); - - const isValid = isValidReference(() => store.selectedCar); - - return isValid; -}; - -export const tryReferenceAndFail = () => { - const Car = types.model("Car", { - id: types.identifier, - }); - - const CarStore = types.model("CarStore", { - cars: types.array(Car), - selectedCar: types.maybe(types.reference(Car)), - }); - - // create a store with a normalized snapshot - const store = CarStore.create({ - cars: [ - { - id: "47", - }, - ], - selectedCar: "47", - }); - - applySnapshot(store, { - ...store, - selectedCar: "48", - }); - - const isValid = tryReference(() => store.selectedCar); - - return isValid; -}; - -export const tryReferenceAndSucceed = () => { - const Car = types.model("Car", { - id: types.identifier, - }); - - const CarStore = types.model("CarStore", { - cars: types.array(Car), - selectedCar: types.maybe(types.reference(Car)), - }); - - // create a store with a normalized snapshot - const store = CarStore.create({ - cars: [ - { - id: "47", - }, - ], - selectedCar: "47", - }); - - const isValid = tryReference(() => store.selectedCar); - - return isValid; -}; diff --git a/scenarios/refine-reference-and-fail.perf.md b/scenarios/refine-reference-and-fail.perf.md new file mode 100644 index 0000000..2ec535b --- /dev/null +++ b/scenarios/refine-reference-and-fail.perf.md @@ -0,0 +1,33 @@ +--- +title: "Refine a reference and fail" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +const Car = types.model("Car", { + id: types.refinement( + types.identifier, + (identifier) => identifier.indexOf("Car_") === 0 + ), +}); + +const CarStore = types.model("CarStore", { + cars: types.array(Car), + selectedCar: types.reference(Car), +}); + +// create a store with a normalized snapshot +const storeInstance = CarStore.create({ + cars: [ + { + id: "47", + }, + ], + selectedCar: "47", +}); + +return storeInstance.selectedCar.id; // throws +``` diff --git a/scenarios/refine-reference-and-succeed.perf.md b/scenarios/refine-reference-and-succeed.perf.md new file mode 100644 index 0000000..8989a73 --- /dev/null +++ b/scenarios/refine-reference-and-succeed.perf.md @@ -0,0 +1,33 @@ +--- +title: "Refine a reference and succeed" +--- + +```js +import { types } from "mobx-state-tree"; +``` + +```js +const Car = types.model("Car", { + id: types.refinement( + types.identifier, + (identifier) => identifier.indexOf("Car_") === 0 + ), +}); + +const CarStore = types.model("CarStore", { + cars: types.array(Car), + selectedCar: types.reference(Car), +}); + +// create a store with a normalized snapshot +const storeInstance = CarStore.create({ + cars: [ + { + id: "Car_47", + }, + ], + selectedCar: "Car_47", +}); + +return storeInstance.selectedCar.id; // "Car_47" +``` diff --git a/scenarios/snapshots.js b/scenarios/snapshots.js deleted file mode 100644 index 0d114fb..0000000 --- a/scenarios/snapshots.js +++ /dev/null @@ -1,135 +0,0 @@ -import { types, getSnapshot, applySnapshot, onSnapshot } from "mobx-state-tree"; -export const takeSingleSnapshot = () => { - const Model = types.model({ - string: types.string, - number: types.number, - integer: types.integer, - float: types.float, - boolean: types.boolean, - date: types.Date, - }); - - const m = Model.create({ - string: "string", - number: 1, - integer: 1, - float: 1.1, - boolean: true, - date: new Date(), - }); - - const snapshot = getSnapshot(m); - return snapshot; -}; - -export const createModelWithSnapshotListener = () => { - const Model = types.model({ - string: types.string, - number: types.number, - integer: types.integer, - float: types.float, - boolean: types.boolean, - date: types.Date, - }); - - const m = Model.create({ - string: "string", - number: 1, - integer: 1, - float: 1.1, - boolean: true, - date: new Date(), - }); - - onSnapshot(m, (snapshot) => { - return snapshot; - }); - - return m; -}; - -export const executeSimpleSnapshotListenerFromAction = () => { - const Model = types - .model({ - string: types.string, - number: types.number, - integer: types.integer, - float: types.float, - boolean: types.boolean, - date: types.Date, - }) - .actions((self) => { - const changeString = (newString) => { - self.string = newString; - }; - - return { - changeString, - }; - }); - - const m = Model.create({ - string: "string", - number: 1, - integer: 1, - float: 1.1, - boolean: true, - date: new Date(), - }); - - onSnapshot(m, (snapshot) => { - return snapshot; - }); - - m.changeString("newString"); -}; - -export const applySnapshotToModel = () => { - const Model = types.model({ - string: types.string, - number: types.number, - integer: types.integer, - float: types.float, - boolean: types.boolean, - date: types.Date, - }); - - const m = Model.create({ - string: "string", - number: 1, - integer: 1, - float: 1.1, - boolean: true, - date: new Date(), - }); - - const snapshot = getSnapshot(m); - applySnapshot(m, snapshot); -}; - -export const applySnapshotToModelWithListener = () => { - const Model = types.model({ - string: types.string, - number: types.number, - integer: types.integer, - float: types.float, - boolean: types.boolean, - date: types.Date, - }); - - const m = Model.create({ - string: "string", - number: 1, - integer: 1, - float: 1.1, - boolean: true, - date: new Date(), - }); - - onSnapshot(m, (snapshot) => { - return snapshot; - }); - - const snapshot = getSnapshot(m); - applySnapshot(m, snapshot); -}; diff --git a/scenarios/try-reference-and-fail.perf.md b/scenarios/try-reference-and-fail.perf.md new file mode 100644 index 0000000..8071caa --- /dev/null +++ b/scenarios/try-reference-and-fail.perf.md @@ -0,0 +1,37 @@ +--- +title: "Try a reference and fail" +--- + +```js +import { types, tryReference, applySnapshot } from "mobx-state-tree"; +``` + +```js +const Car = types.model("Car", { + id: types.identifier, +}); + +const CarStore = types.model("CarStore", { + cars: types.array(Car), + selectedCar: types.maybe(types.reference(Car)), +}); + +// create a store with a normalized snapshot +const store = CarStore.create({ + cars: [ + { + id: "47", + }, + ], + selectedCar: "47", +}); + +applySnapshot(store, { + ...store, + selectedCar: "48", +}); + +const isValid = tryReference(() => store.selectedCar); + +return isValid; +``` diff --git a/scenarios/try-reference-and-succeed.perf.md b/scenarios/try-reference-and-succeed.perf.md new file mode 100644 index 0000000..e4951bd --- /dev/null +++ b/scenarios/try-reference-and-succeed.perf.md @@ -0,0 +1,32 @@ +--- +title: "Try a reference and succeed" +--- + +```js +import { types, tryReference } from "mobx-state-tree"; +``` + +```js +const Car = types.model("Car", { + id: types.identifier, +}); + +const CarStore = types.model("CarStore", { + cars: types.array(Car), + selectedCar: types.maybe(types.reference(Car)), +}); + +// create a store with a normalized snapshot +const store = CarStore.create({ + cars: [ + { + id: "47", + }, + ], + selectedCar: "47", +}); + +const isValid = tryReference(() => store.selectedCar); + +return isValid; +``` diff --git a/scenarios/zod-comparison.js b/scenarios/zod-comparison.js deleted file mode 100644 index c4a880c..0000000 --- a/scenarios/zod-comparison.js +++ /dev/null @@ -1,165 +0,0 @@ -import { types, typecheck } from "mobx-state-tree"; -import { z } from "zod"; - -const ExampleModelMST = types.model({ - id: types.identifier, - name: types.string, - age: types.number, - isHappy: types.boolean, - createdAt: types.Date, - updatedAt: types.maybeNull(types.Date), - favoriteColors: types.array(types.string), - favoriteNumbers: types.array(types.number), - favoriteFoods: types.array( - types.model({ - name: types.string, - calories: types.number, - }) - ), -}); - -const FalseExampleModelMST = types.model({ - id: types.identifier, - shouldMatch: false, -}); - -const ExampleSchemaZod = z.object({ - id: z.number(), - name: z.string(), - age: z.number(), - isHappy: z.boolean(), - createdAt: z.date(), - updatedAt: z.date().nullable(), - favoriteColors: z.array(z.string()), - favoriteNumbers: z.array(z.number()), - favoriteFoods: z.array( - z.object({ - name: z.string(), - calories: z.number(), - }) - ), -}); - -export const mstTypeCheckModelSuccess = () => { - const model = ExampleModelMST.create({ - id: "1", - name: "John", - age: 42, - isHappy: true, - createdAt: new Date(), - updatedAt: null, - favoriteColors: ["blue", "green"], - favoriteNumbers: [1, 2, 3], - favoriteFoods: [ - { - name: "Pizza", - calories: 1000, - }, - ], - }); - - typecheck(ExampleModelMST, model); -}; - -export const mstTypeCheckModelFailure = () => { - const model = ExampleModelMST.create({ - id: "1", - name: "John", - age: 42, - isHappy: true, - createdAt: new Date(), - updatedAt: null, - favoriteColors: ["blue", "green"], - favoriteNumbers: [1, 2, 3], - favoriteFoods: [ - { - name: "Pizza", - calories: 1000, - }, - ], - }); - - // We expect an error here from MST, so just catch it and keep going. - try { - typecheck(FalseExampleModelMST, model); - } catch (e) { - return; - } -}; - -export const mstTypeCheckSnapshotSuccess = () => { - typecheck(ExampleModelMST, { - id: "1", - name: "John", - age: 42, - isHappy: true, - createdAt: new Date(), - updatedAt: null, - favoriteColors: ["blue", "green"], - favoriteNumbers: [1, 2, 3], - favoriteFoods: [ - { - name: "Pizza", - calories: 1000, - }, - ], - }); -}; - -export const mstTypeCheckSnapshotFailure = () => { - try { - typecheck(FalseExampleModelMST, { - id: "1", - name: "John", - age: 42, - isHappy: true, - createdAt: new Date(), - updatedAt: null, - favoriteColors: ["blue", "green"], - favoriteNumbers: [1, 2, 3], - favoriteFoods: [ - { - name: "Pizza", - calories: 1000, - }, - ], - }); - } catch (e) { - return; - } -}; - -export const zodTypeCheckSuccess = () => { - const schemaSuccess = { - id: 1, - name: "John", - age: 42, - isHappy: true, - createdAt: new Date(), - updatedAt: null, - favoriteColors: ["blue", "green"], - favoriteNumbers: [1, 2, 3], - favoriteFoods: [ - { - name: "Pizza", - calories: 1000, - }, - ], - }; - - ExampleSchemaZod.parse(schemaSuccess); -}; - -export const zodTypeCheckFailure = () => { - const schemaFail = { - id: 1, - name: "John", - }; - - // We expect an error here from Zod, so just catch it and keep going. - try { - ExampleSchemaZod.parse(schemaFail); - } catch (e) { - return; - } -}; diff --git a/test-node.sh b/test-node.sh index 7fae988..a0a1200 100755 --- a/test-node.sh +++ b/test-node.sh @@ -8,5 +8,5 @@ mst_version=$(grep -A 1 '"mobx-state-tree":' package-lock.json | tail -n 1 | awk echo "The installed version of mobx-state-tree is $mst_version" npm run build echo -e "\nRunning the node tests, this may take a while...\n" -node ./build/index.node.bundle.js | tee ./results/"$mst_version"-"$now"-node-results.csv +node --max-old-space-size=8096 ./build/index.node.bundle.js | tee ./results/"$mst_version"-"$now"-node-results.csv